I am trying to get an Image file from the gallery:
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Select Picture"),
GET_IMAGE_FROM_GALLERY);
The message "Selecture Picture" is not shown as a Toast.
And in onActivityResult();
Uri selectedImageUri = data.getData(); //log shows proper URI
String[] projection = { MediaStore.Images.Media.DATA };
Cursor cursor = getContentResolver().query(selectedImageUri,
projection, null, null, null);
int column_index = cursor
.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();
String selectedImagePath = cursor.getString(column_index);
cursor.getString(column_index)
returns Null.
I am testing it on Nexus 4.
EDIT:
Looks like this is a problem with Android 4.4, I have see other apps failing too.