我正在嘗試將可打包的數(shù)組列表傳遞給包含圖像 url 的服務(wù)。出于某種原因,所有數(shù)據(jù)類型都傳遞給服務(wù),但不是 parcelable arraylist。一個錯誤logcat來了E/JavaBinder:!?。∈〉?BINDER 交易 !!! .以下是我的 imageurl Arraylist 模型代碼。public class ImagesUrl implements Parcelable { private int id; private String filename; private String imageurl ; public ImagesUrl(Integer id , String imageurl , String filename) { this.id = id; this.filename = filename; this.imageurl = imageurl ; } public static final Parcelable.Creator<ImagesUrl> CREATOR = new Parcelable.Creator<ImagesUrl>() { public ImagesUrl createFromParcel(Parcel in) { return new ImagesUrl(in.readInt(),in.readString(), in.readString()); } public ImagesUrl[] newArray(int size) { return new ImagesUrl[size]; } }; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getFilename() { return filename; } public void setFilename(String filename) { this.filename = filename; } public String getImageurl() { return imageurl; } public void setImageurl(String imageurl) { this.imageurl = imageurl; } public static Creator<ImagesUrl> getCREATOR() { return CREATOR; } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeInt(id); dest.writeString(filename); dest.writeString(imageurl); } private void readFromParcel(Parcel in) { id = in.readInt(); filename = in.readString(); imageurl = in.readString(); }}這是啟動服務(wù)的代碼: Intent i= new Intent(SyncActivity.this,ImageDownloadService.class); Bundle b=new Bundle(); b.putParcelableArrayList("imageurls", imagesUrlArrayList); b.putInt("int",12); i.putExtras(b); startService(i);如果我在服務(wù)類中獲得 pacelable arraylist,我將調(diào)用 GetImages asyntask。
無法將 parcelable arraylist 發(fā)送到服務(wù)類
慕標(biāo)琳琳
2022-12-15 11:11:20