Skip to content Skip to sidebar Skip to footer

Passing Custom Object With Bitmap To Another Activity?

MyObject class public class MemberDetailsObject implements Serializable { String memberid; String memberName; String mobileNumber; String photo; String phoneType; String latitute

Solution 1:

Passing a Bitmap through Activities is possible but is very expensive for memory. Instead of passing a Bitmap object you should save it on external memory (cache / sd card) and pass its path (wrapped in Serializable Object) to the next Activity, and in the next Activity decode that path into Bitmap and use accordingly.

public class MemberDetailsObject implements Serializable {
    // other member ... 
    String memberImagePath;
    // rest of the class ...
}

For more detail see here:

How to send image from one activity to another

how do you pass images (bitmaps) between android activities using bundles?


Solution 2:


Solution 3:

This is the best way send bitmap to other activity as the bitmap is not serilizable , but implement

Parcelable

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


Post a Comment for "Passing Custom Object With Bitmap To Another Activity?"