michael michael - 1 year ago 77
Android Question

How can I pass a Bitmap object from one activity to another

In my activity, I create a

object and then I need to launch another
How can I pass this
object from the sub-activity (the one which is going to be launched)?

Answer Source

Bitmap implements Parcelable, so you could always pass it in the intent:

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

and retrieve it on the other end:

Intent intent = getIntent();
Bitmap bitmap = (Bitmap) intent.getParcelableExtra("BitmapImage");

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download