这是我的 Product.java
import android.os.Parcel;
import android.os.Parcelable;
public class Product implements Parcelable {
private String name;
private String detail;
private String price;
private int photo;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDetail() {
return detail;
}
public void setDetail(String detail) {
this.detail = detail;
}
public String getPrice() {
return price;
}
public void setPrice(String price) {
this.price = price;
}
public int getPhoto() {
return photo;
}
public void setPhoto(int photo) {
this.photo = photo;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.name);
dest.writeString(this.detail);
dest.writeString(this.price);
dest.writeInt(this.photo);
}
public Product() {
}
protected Product(Parcel in) {
this.name = in.readString();
this.detail = in.readString();
this.photo = in.readInt();
this.price = in.readString();
}
public static final Parcelable.Creator<Product> CREATOR = new Parcelable.Creator<Product>() {
@Override
public Product createFromParcel(Parcel source) {
return new Product(source);
}
@Override
public Product[] newArray(int size) {
return new Product[size];
}
};
}
繁星点点滴滴
相关分类