전달할 객체를 Parcelable 인터페이스를 상속 받아서 아래와 같이 구현을 한다.
절대로 write와 Read순서는 항상 동일~!!!!!!! 절대 중요~!!!
public class ReceivedDateDao implements Parcelable {
public ReceivedDateDao () {
}//end constructor
public ReceivedDateDao (final Parcel in) {
this.readFromParcel(in);
}//end constructor
@Override
public int describeContents() {
return 0;
}//end describeContents Method
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeParcelable(this.mUserDao, 0);
dest.writeString(this.mType);
dest.writeString(this.mStoreId);
dest.writeString(this.mCreated);
dest.writeString(this.mMessage);
dest.writeInt(this.mIsNew);
dest.writeInt(this.mWhoSend);
}//end writeToParcel Method
private void readFromParcel (final Parcel in) {
this.mUserDao = in.readParcelable(UserDao.class.getClassLoader());
this.mType = in.readString();
this.mStoreId = in.readString();
this.mCreated = in.readString();
this.mMessage = in.readString();
this.mIsNew = in.readInt();
this.mWhoSend = in.readInt();
}//end readFromParcel Mehod
public static final Parcelable.Creator<ReceivedDateDao> CREATOR = new Creator<ReceivedDateDao>() {
public ReceivedDateDao createFromParcel(Parcel source) {
return new ReceivedDateDao(source);
}//end createFromParcel Method
public ReceivedDateDao[] newArray(int size) {
return new ReceivedDateDao[size];
}//end newArray Method
};
'Development > Android' 카테고리의 다른 글
[Android] GCM구현하기~! (2) | 2013.12.16 |
---|---|
[Android] Google Service Library 추가하기~! (3) | 2013.12.16 |
[Spring Framework] RestTemplate 사용시 Caused by: java.io.EOFException 에러... (0) | 2013.12.14 |
[Android] Maven 연동 & SpringFramework 설치하기~! (0) | 2013.12.04 |
[Android] In App Billing - Version3 적용하기~! (0) | 2013.12.03 |