Reputation: 2753
MyObject class
public class MemberDetailsObject implements Serializable {
String memberid;
String memberName;
String mobileNumber;
String photo;
String phoneType;
String latitute ;
String longitude;
String dateNTime;
String locationName;
String date;
String time;
Bitmap memberImage;
public String getMemberid() {
return memberid;
}
public void setMemberid(String memberid) {
this.memberid = memberid;
}
public String getMemberName() {
return memberName;
}
public void setMemberName(String memberName) {
this.memberName = memberName;
}
public String getMobileNumber() {
return mobileNumber;
}
public void setMobileNumber(String mobileNumber) {
this.mobileNumber = mobileNumber;
}
public String getPhoto() {
return photo;
}
public void setPhoto(String photo) {
this.photo = photo;
}
public String getPhoneType() {
return phoneType;
}
public void setPhoneType(String phoneType) {
this.phoneType = phoneType;
}
public String getLatitute() {
return latitute;
}
public void setLatitute(String latitute) {
this.latitute = latitute;
}
public String getLongitude() {
return longitude;
}
public void setLongitude(String longitude) {
this.longitude = longitude;
}
public String getDateNTime() {
return dateNTime;
}
public void setDateNTime(String dateNTime) {
this.dateNTime = dateNTime;
}
public String getLocationName() {
return locationName;
}
public void setLocationName(String locationName) {
this.locationName = locationName;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public Bitmap getMemberImage() {
return memberImage;
}
public void setMemberImage(Bitmap memberImage) {
this.memberImage = memberImage;
}
public MemberDetailsObject(String memberid, String memberName,
String mobileNumber, String photo, String phoneType, String latitute,
String longitude, String dateNTime, String locationName, String date,
String time, Bitmap memberImage) {
super();
this.memberid = memberid;
this.memberName = memberName;
this.mobileNumber = mobileNumber;
this.photo = photo;
this.phoneType = phoneType;
this.latitute = latitute;
this.longitude = longitude;
this.dateNTime = dateNTime;
this.locationName = locationName;
this.date = date;
this.time = time;
this.memberImage = memberImage;
}
}
I am trying to pass it using
Intent viewProfile = new Intent(getApplicationContext(), ScreenMemberProfile.class);
viewProfile.putExtra("memberList", memberList.get(positon));
however the problem is that bitmap is not serilizable, may i know any other alternative
Upvotes: 0
Views: 1063
Reputation: 18746
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
Upvotes: 0
Reputation: 37729
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?
Upvotes: 1