ravi
ravi

Reputation: 2792

How to pass Bitmap through bundle and receive the same bitmap in android

In my app there is a module in which the user has to take multiple pictures. After capturing the image i am converting the imageURI to bitmap and placing that bitmap to the ImageView. The app works fine in all the devices except in Samsung. In order to fix this issue i have to pass the bitmap to onSaveInstanceState method and receive that bitmap in onCreate method. For doing this i have pass the bitmap to Bundle but i am unable to pass the bitmap through bundle. Can anyone please help me.

Thanks in advance.

Upvotes: 0

Views: 712

Answers (1)

Sunny
Sunny

Reputation: 14828

Bitmap class implements Parceable Interface So you can save it in bundle as .

saveInstance.putParcelable("bm", yourBitmap);

and recieve it as

Bitmap bm = savedInstance.getParcelable("bm");

Upvotes: 3

Related Questions