我正在尝试为具有以下字段的类实现parcelable。尝试从字段String mStyle []和byte [] mImage中的parcel(放入一个包)创建类时我得到一个例外。我没有在writeToParcel上的这些字段上收到任何错误 - 什么是正确的用法?。非常感谢
private String mClothingItemName;
private String mColor;
private String mPrint;
private String mStyle[];
private String mMaterial;
private String mBrand;
private String mStorageLocation;
private String mOptionalDescription;
private byte[] mImage;
public void writeToParcel(Parcel out, int flags) {
out.writeString(mClothingItemName);
out.writeLong(mClothesId);
out.writeString(mColor);
out.writeString(mPrint);
//out.writeStringArray(mStyle);
out.writeString(mMaterial);
out.writeString(mBrand);
out.writeString(mStorageLocation);
out.writeString(mOptionalDescription);
// out.writeByteArray(mImage);
}
private Clothes(Parcel in) {
mClothingItemName = in.readString();
mClothesId = in.readLong();
mColor = in.readString();
mPrint = in.readString();
// in.readStringArray(mStyle);
mMaterial = in.readString();
mBrand = in.readString();
mStorageLocation = in.readString();
mOptionalDescription = in.readString();
//in.readByteArray(mImage);
}