package com.sl.pocketbook.bean;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.Creator;
/**
* 品牌
*
* @author sxn
*
*/
public class ProductBrandBean implements Parcelable {
/**
* id
*/
private int id;
/**
* 数量
*/
private int conunt;
/**
* icon
*/
private String urlIcon;
/**
* 名称
*/
private String brandName;
public static final Parcelable.Creator<ProductBrandBean> CREATOR = new Creator<ProductBrandBean>() {
@Override
public ProductBrandBean createFromParcel(Parcel source) {
// TODO Auto-generated method stub
// 必须按成员变量声明的顺序读取数据,不然会出现获取数据出错
ProductBrandBean p = new ProductBrandBean();
p.setId(source.readInt());
p.setConunt(source.readInt());
p.setUrlIcon(source.readString());
p.setBrandName(source.readString());
return p;
}
@Override
public ProductBrandBean[] newArray(int size) {
// TODO Auto-generated method stub
return new ProductBrandBean[size];
}
};
public String getBrandName() {
return brandName;
}
public void setBrandName(String brandName) {
this.brandName = brandName;
}
public ProductBrandBean() {
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getConunt() {
return conunt;
}
public void setConunt(int conunt) {
this.conunt = conunt;
}
public String getUrlIcon() {
return urlIcon;
}
public void setUrlIcon(String urlIcon) {
this.urlIcon = urlIcon;
}
@Override
public int describeContents() {
// TODO Auto-generated method stub
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
// 1.必须按成员变量声明的顺序封装数据,不然会出现获取数据出错
// 2.序列化对象
dest.writeInt(id);
dest.writeInt(conunt);
dest.writeString(urlIcon);
dest.writeString(brandName);
}
}
android实现Parcelable序列化对象,布布扣,bubuko.com
android实现Parcelable序列化对象