0

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); 

}

1
  • it save/mnt/sdcard/Pictures/Gallery and it didnt show anything.. Switch your device off and on again. But are they really saved there? Dont think so. Tell the exact full path in fileName please. Commented Apr 11, 2016 at 17:22

2 Answers 2

1

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

Sign up to request clarification or add additional context in comments.

2 Comments

Cursor cc = this.getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, null, null, null,null); startManagingCursor(cc);
It does not show anything and I want to open gallery from sdcard and pick one
0

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.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.