Example:
- If you want to pass an Object (Note.java) from one activity to another.
- The Note.java should implement android.os.Parcelable interface.
- Before you say startActivity(intent) on the source activity to navigate.
- Say intent.putExtra("com.ez.editor.note", note); where note is an object.
- On the target activity this.getIntent().getParcelableExtra("com.ez.editor.note"); should return you the object that you intent to pass.
public class Note implements Parcelable {
public static final Parcelable.CreatorCREATOR = new Parcelable.Creator () {
public Note createFromParcel(Parcel in) {
return new Note(in);
}
@Override
public void writeToParcel(Parcel out, int flags) {
out.writeString(name);
out.writeInt(index);
}
public Note[] newArray(int size) {
return new Note[size];
}
};
}
1 comment:
Good stuff dude keep it up.
Thanks
Javin
deadlock in java
Post a Comment