码迷,mamicode.com
首页 > 移动开发 > 详细

android 开发Parcelable 怎么传值ArrayList

时间:2015-09-01 18:17:30      阅读:280      评论:0      收藏:0      [点我收藏+]

标签:

public class TradeEntity implements Parcelable{
    public String id;
    
    //有关进度条的参数
    ArrayList<TradeStateNodeInfo> nodes;
    public TradeEntity() {
        nodes = new ArrayList<TradeStateNodeInfo>();
    }
    /////////////////////////实现parcel接口///////////////////////////////
    @Override
    public int describeContents() {
        return 0;
    }
    @Override
    public void writeToParcel(Parcel out, int arg1) {
        out.writeString(id);
        out.writeList(nodes);
    }
    private TradeEntity(Parcel in)
    {
        id = in.readString();
        nodes = in.readArrayList(TradeStateNodeInfo.class.getClassLoader());
    }
    public static final Parcelable.Creator<TradeEntity> CREATOR = new Parcelable.Creator<TradeEntity>() 
    {
        public TradeEntity createFromParcel(Parcel in) 
        {
            return new TradeEntity(in);
        }

        public TradeEntity[] newArray(int size) 
        {
            return new TradeEntity[size];
        }
    };
}

 

android 开发Parcelable 怎么传值ArrayList

标签:

原文地址:http://www.cnblogs.com/feijian/p/4776394.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!