我是新的android.and我需要一些幫助 我有ArrayList這是一個對象實現Parciable .and我想要傳遞這個ArrayList到另一個活動。 這是我NewsEntity.javaandroid傳遞對象包含bitMap到另一個活動
公共類NewsEntity實現Parcelable { /** * * / 私營位圖位圖; 私有字符串標題; 私人字符串簡要; 私人字符串細節; 私人字符串記者; private String ImageFile; 私人字符串日期; private String readCount; private String shareCount; public int addRead_count; public int addShare_count;
private static ByteBuffer dst;
private static byte[] bytesar;
public NewsEntity() {
bitmap=null;
title="";
brief="";
details="";
reporter="";
ImageFile="";
date="";
readCount="";
shareCount="";
addRead_count=0;
addShare_count=0;
}
public void setTitle(String title) {
this.title = title;
}
public String getTitle() {
return title;
}
public void setBrief(String brief) {
this.brief = brief;
}
public String getBrief() {
return brief;
}
public void setDetails(String details) {
this.details = details;
}
public String getDetails() {
return details;
}
public void setReporter(String reporter) {
this.reporter = reporter;
}
public String getReporter() {
return reporter;
}
public void setImageFile(String imageFile) {
ImageFile = imageFile;
}
public String getImageFile() {
return ImageFile;
}
public void setDate(String date) {
this.date = date;
}
public String getDate() {
return date;
}
public void setReadCount(String readCount) {
this.readCount = readCount;
}
public String getReadCount() {
return readCount;
}
public void setShareCount(String shareCount) {
this.shareCount = shareCount;
}
public String getShareCount() {
return shareCount;
}
public Bitmap getBitmap() {
return bitmap;
}
public void setBitmap(Bitmap bitmap) {
this.bitmap = bitmap;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel out, int flags) {
try{
out.writeString(title);
out.writeString(brief);
out.writeString(details);
out.writeString(reporter);
out.writeString(readCount);
out.writeString(shareCount);
out.writeInt(addRead_count);
out.writeInt(addShare_count);
out.writeString(date);
out.writeString(ImageFile);
}
public static final Parcelable.Creator<NewsEntity> CREATOR = new Parcelable.Creator<NewsEntity>() {
//public class MyCreator implements Parcelable.Creator<MyProduct> {
public NewsEntity createFromParcel(Parcel in) {
return new NewsEntity();
}
public NewsEntity[] newArray(int size) {
return new NewsEntity[size];
}
};
private NewsEntity(Parcel in) {
try{
title=(String) in.readString();
brief=(String) in.readString();
details=(String) in.readString();
date=(String) in.readString();
reporter=(String) in.readString();
readCount=(String) in.readString();
shareCount=(String) in.readString();
ImageFile=(String) in.readString();
addRead_count=(Integer) in.readInt();
addShare_count=(Integer) in.readInt();
bitmap=in.readParcelable(Bitmap.class.getClassLoader());
}
catch(Exception e){}
}
}
和這條線,其通過ArrayList的意圖 newsDetailsIntent.putExtra( 「顯示」,result_news); startActivity(newsDetailsIntent);
我需要help.how做
在此先感謝
這個問題問了很多次以活動之間的傳遞位圖.....嘗試自己更好 – 2012-03-08 14:22:31
可能的重複[如何將位圖對象從1個活動傳遞給另一個](http://stackoverflow.com/questions/2459524/how-can-i-pass-a- bitmap-object-from-1-activity-to-another) – 2012-03-08 14:22:48
我已經閱讀了很多文章,但sti我不會再嘗試。謝謝samir – 2012-03-08 14:31:19