ericlee
ericlee

Reputation: 2753

Android Passing Bitmap Through Activity

i currently have a class that uses bitmap. however it is not serializable due to bitmap. Right now i am wondering which are the best ways to deal with it.

Should i be storing it on the cache or sdcard? How ong does bitmap saved in cache or sdcard stays? is there any tutorial for doing those

Upvotes: 1

Views: 611

Answers (1)

dark_shadow
dark_shadow

Reputation: 3573

You can pass bitmap object from one activity to another.Take a look at the following:

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:

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

Upvotes: 3

Related Questions