I have some images stored in getExternalFilesDir()
and i am trying to show those images in the android gallery (cooliris).
Right now i have been doing this:
Intent intent = new Intent();
intent.setAction(android.content.Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(imgPath,"image/*");
startActivity(intent);
But nothing happens. I have changed the setDataAndType to this:
intent.setDataAndType(Uri.fromFile(new File(imgPath)),"image/*");
This way it works, but it takes 5-10 seconds for the gallery to go from a black screen to showing my image.
Anyway to solve this or any better approach?
By implementing a file content provider you will be able to avoid this 5-10 second delay
Then you can call
This is a strange workaround but I think it has something to do with how android opens images using a URI. Their openFile(Uri uri, String mode) method is wrong / broken / can't resolve the URI properly.. I'm not really 100% sure though but I found this workaround to be effective.
don't forget to register to provider in the manifest