Mulgard
Mulgard

Reputation: 10609

Setting a Bitmap as intent extra causes error

I need to put a bitmap into an intent extra:

Intent intent = new Intent(this.getActivity(), CropActivity.class);
intent.putExtra(Globals.KEY_IMAGE, this.imageBitmap);

Unfortunately I get the following error:

E/JavaBinder﹕ !!! FAILED BINDER TRANSACTION !!!

I guess it is because the size of an extra is limited to 1mb. How else could i get that bitmap from one activity to another?

Upvotes: 1

Views: 270

Answers (1)

CommonsWare
CommonsWare

Reputation: 1007369

Either:

  • Don't use multiple activities here, but instead use one activity, perhaps with multiple fragments, or

  • Carefully pass the Bitmap via a static data member, making sure to set that data member to null after the new activity has the Bitmap, to prevent a major memory leak

Upvotes: 3

Related Questions