I Tried To Pass An Object Class From An Activity To Another Using Parcelable
I\'ve Create A Class And Name it Student
package com.example.test08_pas
You need to implement the code to write and read your class fields from parcel.
In writeToParcel
:
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(st_AcadimicNumber);
dest.writeString(st_Name);
dest.writeString(st_Class);
}
The Parcel CREATOR:
public static final Parcelable.Creator
And the constructor:
public Student (Parcel source){
/*
* Reconstruct from the Parcel. Keep same order as in writeToParcel()
*/
st_AcadimicNumber = source.readString();
st_Name = source.readString();
st_Class = source.readString();
}
And it's done.
Regards