I am developing an app, where an image taken from the native camera app. is to be shown to the user. The code I did is:
/* Intent */
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intent, TAKE_PICTURE);
/* Result */
onActivityResult(int requestCode, int resultCode,
Intent returnIntent) {
if(requestCode == TAKE_PICTURE) {
//picture from Camera
if (resultCode == Activity.RESULT_OK) {
if(returnIntent != null) {
try {
// Get the file path where the image is stored.
// This runs fine on all devices, except Samsung ones.
Uri selectedImage = returnIntent.getData();
if(selectedImage == null) {
if(returnIntent.getExtras() != null &&
returnIntent.getExtras().get(AppConstants.DATA) != null) {
// But, I get the image Bitmap here. Means the image is stored in disk.
Bitmap bmp = (Bitmap) returnIntent.getExtras().get(AppConstants.DATA);
}
}
} catch (Exception e) {
//
}
}
}
}
}
The problem here is, the above code works fine on all devices I tried (HTC's, SE's) but it somehow fails in the Samsung ones. The "Uri selectedImage = returnIntent.getData();" never returns anything. As my entire app is built over this logic of file path storing, I am not able to proceed. Is there any solution people.