Display Jpg Image From Intent In Imageview
How to display an Image received from an 'android.intent.action.SEND' in an imageview? The user selects my app from the list of apps to share an image. The image is sent via intent
Solution 1:
You are receving Image in Intent, So you have to update your Manifest as:
<activityandroid:name=".Your_Activity" >
...
...
<intent-filter>
...
<actionandroid:name="android.intent.action.SEND" /><categoryandroid:name="android.intent.category.DEFAULT" /><dataandroid:mimeType="image/*" /></intent-filter>
</activity
Then Activity needs:
voidonCreate(Bundle savedInstanceState) {
...
// Get intent, action and MIME typeIntentintent= getIntent();
Stringaction= intent.getAction();
Stringtype= intent.getType();
if (Intent.ACTION_SEND.equals(action) && type != null) {
if (type.startsWith("image/")) {
UriimageUri= (Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM);
if (imageUri != null) {
YourImageView.setImageUri(imageUri);
}
}
.
.
.
Solution 2:
Try this
BitMap thumnail= (Bitmap) getIntent().getExtras().getParcelable("data");
yourImageViewId.setImageBitmap(receiptimage);
Hope it helps
Solution 3:
Bitmap
implements Parcelable
interface. So to pass it use
intent.putExtra("bitmap", bitmap);
and to retrieve it use:
Bitmapbitmap= (Bitmap) intent.getParcelableExtra("bitmap");
and use ImageView.setImageBitmap().
EDIT: see Receiving Content from Other Apps
Post a Comment for "Display Jpg Image From Intent In Imageview"