首页 > 其他 > 详细

实现parcelable接口中list处理方法

时间:2015-04-12 21:09:49      阅读:362      评论:0      收藏:0      [点我收藏+]


import java.util.ArrayList;
import java.util.List;

import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.Creator;

/**
 * 商家分类信息 
 * @author xiaoyi
 *
 * 2015年4月12日
 */
public class Arr_seller_type implements Parcelable{

	private String seller_type;
	private String seller_type_name;
	private String picture;
	private String color;
	private ArrayList<helperPoSort> sub_type;
	public String getSeller_type() {
		return seller_type;
	}
	public void setSeller_type(String seller_type) {
		this.seller_type = seller_type;
	}
	public String getSeller_type_name() {
		return seller_type_name;
	}
	public void setSeller_type_name(String seller_type_name) {
		this.seller_type_name = seller_type_name;
	}
	public String getPicture() {
		return picture;
	}
	public void setPicture(String picture) {
		this.picture = picture;
	}
	public String getColor() {
		return color;
	}
	public void setColor(String color) {
		this.color = color;
	}
	public List<helperPoSort> getSub_type() {
		return sub_type;
	}
	public void setSub_type(ArrayList<helperPoSort> sub_type) {
		this.sub_type = sub_type;
	}
	@Override
	public String toString() {
		return "Arr_seller_type [seller_type=" + seller_type
				+ ", seller_type_name=" + seller_type_name + ", picture="
				+ picture + ", color=" + color + ", sub_type=" + sub_type + "]";
	}
	public Arr_seller_type(String seller_type, String seller_type_name,
			String picture, String color, ArrayList<helperPoSort> sub_type) {
		super();
		this.seller_type = seller_type;
		this.seller_type_name = seller_type_name;
		this.picture = picture;
		this.color = color;
		this.sub_type = sub_type;
	}
	
	public Arr_seller_type() {
		// TODO Auto-generated constructor stub
	}
	@Override
	public int describeContents() {
		// TODO Auto-generated method stub
		return 0;
	}
	@Override
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeString(seller_type);
		dest.writeString(seller_type_name);
		dest.writeString(color);
		dest.writeString(picture);<span style="color:#ff0000;">
		dest.writeList(sub_type);</span>
	}
	
public static final Parcelable.Creator<Arr_seller_type> CREATOR = new Creator<Arr_seller_type>() {
		
		@Override
		public Arr_seller_type[] newArray(int size) {
			return new Arr_seller_type[size];
		}
		
		@Override
		public Arr_seller_type createFromParcel(Parcel source) {
			Arr_seller_type parcelableHelperPo = new Arr_seller_type();
			parcelableHelperPo.seller_type = source.readString();
			parcelableHelperPo.seller_type_name = source.readString();
			parcelableHelperPo.picture = source.readString();
			parcelableHelperPo.color = source.readString();<span style="color:#ff0000;">
			//<span style="font-family: Arial, Helvetica, sans-serif;">helperPoSort也实现parcelable接口</span>
			parcelableHelperPo.sub_type = new ArrayList<helperPoSort>();
			source.readList(parcelableHelperPo.sub_type, getClass().getClassLoader());</span>
			return parcelableHelperPo;
		}
	};
	
}


实现parcelable接口中list处理方法

原文:http://blog.csdn.net/xiaoyi_tdcq/article/details/45013113

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!