In my application i am select image from the gallery and setting it to the image view.The problem is that the image is not being displayed in the image view.I had debugged but app for the prob,so i found that the method BitmapFactory.decodeFile("image path") is returning null value even thought the path which i am getting is totally fine.
Code
case R.id.imageView:
intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(intent, GALLERY_CODE);
break;
if (requestCode == GALLERY_CODE && resultCode == RESULT_OK && null != data) {
Uri selectedImage = data.getData();
String[] filePathColumn = {MediaStore.Images.Media.DATA};
Cursor cursor = getContentResolver().query(selectedImage,
filePathColumn, null, null, null);
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
String picturePath = cursor.getString(columnIndex);
cursor.close();
Bitmap image = BitmapFactory.decodeFile(picturePath);
ivImage.setImageBitmap(image);
}
}
I dont know why this is happening. Please do help me out