I use this intention:
Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI);
And in onActivityResult() I have this:
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode != Activity.RESULT_OK) { return; // user cancelled } Uri imageUri = data.getData(); if (imageUri == null) { // (code to show error message goes here) return; } // Get image path from media store String[] filePathColumn = { android.provider.MediaStore.MediaColumns.DATA }; Cursor cursor = this.getContentResolver().query(imageUri, filePathColumn, null, null, null); if (cursor == null || !cursor.moveToFirst()) { // (code to show error message goes here) return; } int columnIndex = cursor.getColumnIndex(filePathColumn[0]); String imagePath = cursor.getString(columnIndex); cursor.close(); if (imagePath == null) { // error happens here } }
When I select images from certain albums, such as Messages, Profile Photos (see screenshot), I cannot get the image path in onActivityResult() . Images from other albums can be selected without problems.

I tried adding intent.putExtra("return-data", true) , but data.getExtras() returns null in onActivityResult() .
There is a similar question here , but no one answered it.
Please, help!
android android-intent
Lev Mar 08 '13 at 0:29 2013-03-08 00:29
source share