Reputation: 77
I am trying to open gallery from sdcard.But it shows pictures from gallery but not the sdcard. I take photo and it save/mnt/sdcard/Pictures/Gallery and it didnt show anything.
Open Gallery code
if (id == R.id.open_gallery) {
Intent intent = new Intent(Intent.ACTION_PICK, Uri.parse("content://media/internal/images/media"));
startActivityForResult(intent, 0);
}
Upvotes: 0
Views: 87
Reputation: 1006614
I am trying to open gallery from sdcard.
There is no requirement that any Android device have this capability. A device does not need to have any sort of "gallery", let alone one controllable in this fashion.
I take photo and it save/mnt/sdcard/Pictures/Gallery
No, you do not. For one, not every device has such a location.
Take photo
This has nothing to do with removable storage. This is saving images on external storage.
Open Gallery code
There is no requirement that there be an app with an activity that supports that Intent
. Even if there is, you are not passing the location that you used when you saved the image. content://media/internal/images/media
is not new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), APP_TAG)
.
Use the instructions from the other answer and build your own image-browsing capability into your app.
Upvotes: 0
Reputation: 73
Use Content Resolver and use Media Store class, you will get all images from external media inside a cursor.
MediaStore.Images.Media.EXTERNAL_CONTENT_URI
Check the this url
Upvotes: 1