public class Bill implements Parcelable{ // 订单号 public int orderid; // 原系统id public int oldid; // 订单地址 public String address; // 订单备注 public String ext; // 订单电话 public String mobile; // 订单用户姓名 public String name; // 已支付金额 public double payed; // 订单时间 public String date; // 订单总价 public double total; // 所需付款 public double pay; // 店铺名称 public String shopname; // 店铺电话 public String shopphone; // 订单状态,0待确定,1已确定 public int state; // 接受此订单的员工 public int staff; //是否送达,0未送达,1送达 public int type; // 货物 public Goods goods[]; public Bill() { // TODO Auto-generated constructor stub } protected Bill(Parcel in) { orderid = in.readInt(); oldid = in.readInt(); address = in.readString(); ext = in.readString(); mobile = in.readString(); name = in.readString(); payed = in.readDouble(); date = in.readString(); total = in.readDouble(); pay = in.readDouble(); shopname = in.readString(); shopphone = in.readString(); state = in.readInt(); staff = in.readInt(); type = in.readInt(); Parcelable[] parcelables = in.readParcelableArray(Goods.class.getClassLoader()); if (parcelables != null) { goods = Arrays.copyOf(parcelables, parcelables.length, Goods[].class); } } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeInt(orderid); dest.writeInt(oldid); dest.writeString(address); dest.writeString(ext); dest.writeString(mobile); dest.writeString(name); dest.writeDouble(payed); dest.writeString(date); dest.writeDouble(total); dest.writeDouble(pay); dest.writeString(shopname); dest.writeString(shopphone); dest.writeInt(state); dest.writeInt(staff); dest.writeInt(type); dest.writeParcelableArray(goods, flags); } @SuppressWarnings("unused") public static final Parcelable.Creator<Bill> CREATOR = new Parcelable.Creator<Bill>() { @Override public Bill createFromParcel(Parcel in) { return new Bill(in); } @Override public Bill[] newArray(int size) { return new Bill[size]; } }; }
Goods对象实现了Parcelable接口
原文地址:http://blog.csdn.net/qq634416025/article/details/44222301