I just inserted some pictures in my internal storage but they aren't visible in the gallery then.
Can someone explain me why?
Here is my code :
File photosFolder = new File(getContext().getExternalFilesDir(null),"myPictures");
photosFolder.mkdirs();
String[] pictures = null;
try {
pictures = assetManager.list("photos");
} catch (IOException e) {
Log.e("tag", "Failed to get asset file list.", e);
}
for(String filename : pictures) {
InputStream in = null;
OutputStream out = null;
try {
in = assetManager.open("photos/"+filename);
File outFile = new File(photosFolder, filename);
out = new FileOutputStream(outFile);
copyFile(in, out);
in.close();
in = null;
out.flush();
out.close();
out = null;
MediaScannerConnection.scanFile(getContext(), new String[]{outFile.toString()}, null, new MediaScannerConnection.OnScanCompletedListener() {
@Override
public void onScanCompleted(String path, Uri uri) {
Log.i("External Storage", "Scanned"+ path +":");
Log.i("External Storage", "uri "+uri);
}
});
} catch(IOException e) {
Log.e("tag", "Failed to copy asset file: " + filename, e);
}
}
I don't have any result with this, any help ?