Bonjour,

J'éssaye de copier un fichier provenant du répertoire Asset sur ma carte sd.

Le fichier est crée mais ne contient rien 0Ko en taille.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 
InputStream is = getResources().getAssets().open("icon.png");
 
File root = Environment.getExternalStorageDirectory();
		localFilePath = root.getPath() + "/icon.png";
		FileOutputStream fos;
		try {
			fos = new FileOutputStream(localFilePath, false);
			OutputStream os = new BufferedOutputStream(fos);
			byte[] buffer = new byte[1024];
 
			int byteRead = 0;
 
			while ((byteRead = is.read(buffer)) != -1) {
 
				os.write(buffer, 0, byteRead);
 
			}
			fos.close();
D'où cela pourrais venir?

Merci.