O^O

在android中创建包含对象数组对象List 的Parcelable

<pre name="code" class="java">public class Bill implements Parcelable {
	public int staff;
	public int type;
	public Goods goods[];
	public List<Goods> arrgoods;

	@Override
	public int describeContents() {
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeInt(staff);
		dest.writeInt(type);
		dest.writeParcelableArray(goods, flags);
	}

	@SuppressWarnings("unused")
	public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
		@Override
		public Bill createFromParcel(Parcel in) {
			return new Bill(in);
		}

		@Override
		public Bill[] newArray(int size) {
			return new Bill[size];
		}
	};
}



            
阅读更多
个人分类: android
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭