How To Select An Image From Gallery Or To Capture A Photo And Then To Display It In Another Activity Full Quality
I have two image buttons,for camera and gallery . If you select 'camera' you can capture a photo from camera and then that photo has to be displayed in another activity in image vi
Solution 1:
There are a few problems with your code, including:
getRealPathFromURI()
is unreliable in general and unnecessary in this case. Pass theUri
itself toShowPhotoActivity
.ShowPhotoActivity
is loading the image on the main application thread. Do not do this. Please use one of many image loading libraries available for Android, as they can load your image asychronously using theUri
. Personally, I use Picasso.You are assuming that you get a
Uri
back fromACTION_IMAGE_CAPTURE
. That is not howACTION_IMAGE_CAPTURE
works.
Instead, replace:
UrireturnUri= data.getData();
BitmapbitmapImage= MediaStore.Images.Media.getBitmap(MainActivity.this.getContentResolver(), returnUri);
with:
BitmapbitmapImage= (Bitmap)data.getExtra("data");
Post a Comment for "How To Select An Image From Gallery Or To Capture A Photo And Then To Display It In Another Activity Full Quality"