In my Android project I have imageButton , and after clicking on it , it must open new Activity with imageView , and in my new Activity I must see the ImageButton\'s image only
Above solutions not works in my case, so I found this it work for me Try this one.
private Bitmap decodeUri(Uri selectedImage) throws FileNotFoundException {
BitmapFactory.Options op = new BitmapFactory.Options();
op.inJustDecodeBounds = true;
BitmapFactory.decodeStream(
getActivity().getContentResolver().openInputStream(selectedImage), null, op);
final int REQUIRED_SIZE = 1000;
int width_tmp = op.outWidth, height_tmp = op.outHeight;
int scale = 1;
while (true) {
if (width_tmp / 2 < REQUIRED_SIZE || height_tmp / 2 < REQUIRED_SIZE) {
break;
}
width_tmp /= 2;
height_tmp /= 2;
scale *= 2;
}
BitmapFactory.Options op2 = new BitmapFactory.Options();
op2.inSampleSize = scale;
return BitmapFactory.decodeStream(
getActivity().getContentResolver().openInputStream(selectedImage), null, op2);
}
Then set returned Bitmap in to your imageView like below
yourImageView.setImageBitmap(returnedBitmap);