3

I have this code:

 Intent intent = new Intent();
 intent.setAction(Intent.ACTION_SEND);
 startActivity(intent);

which successfully launches an Messaging App on android.

But how can i attach a Bitmap object when launching the intent?

I have read http://developer.android.com/reference/android/content/Intent.html, the closet thing to what i need is EXTRA_STREAM, like this: intent2.putExtra(Intent.EXTRA_STREAM, _uri);

but my case, I have a reference of Bitmap object, not an URI of an Bitmap.

Please tell me what can I do to attach a Bitmap object?

Thank you.

Coral Doe
  • 1,925
  • 3
  • 19
  • 36
hap497
  • 154,439
  • 43
  • 83
  • 99
  • **You can see the answer here:** http://stackoverflow.com/questions/2459524/how-can-i-pass-a-bitmap-object-from-1-activity-to-another – Ryan Amaral Aug 21 '11 at 23:40

2 Answers2

0
Intent intent = new Intent(this, NewActivity.class);
intent.putExtra("BitmapImage", bitmap);

and retrieve it on the other end:

Bitmap bitmap = (Bitmap) intent.getParcelableExtra("BitmapImage");
Last Warrior
  • 1,307
  • 1
  • 11
  • 20
0

I'm having kind of the same problem. I tried this:

intent.putExtra("image", image);

But when I ran the program, it couldn't launch the new activity. It looked like the system was stuck at this point. The UI was not rendered but a black screen instead. I waited for a while and it asked me whether I wanted to force quit.

In short, how to we pass Bitmap data between activities?

Thanks

Phil
  • 5,595
  • 5
  • 35
  • 55