调用方法:ArrayList<TopicSubBean> topicSubBeanArrayList=new ArrayList<TopicSubBean>();Parcel parcel=Parcel.obtain();for(int i=0;i<subBeanList.size();i++){ TopicSubBean topicSubBean=TopicSubBean.CREATOR.createFromParcel(parcel); topicSubBean.desc=subBeanList.get(i).desc; topicSubBeanArrayList.add(topicSubBean);}parcel.recycle();实体类public class TopicSubBean implements Parcelable{ public String imgUrl; /* public String videoUrl; public int height; public int width;*/ public String desc; @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(imgUrl); dest.writeString(desc); } public static final Creator<TopicSubBean> CREATOR = new Creator<TopicSubBean>() { @Override public TopicSubBean createFromParcel(Parcel in) { return new TopicSubBean(in); } @Override public TopicSubBean[] newArray(int size) { return new TopicSubBean[size]; } }; PRotected TopicSubBean(Parcel in) { imgUrl = in.readString(); desc = in.readString(); }}
新闻热点
疑难解答