Monday, December 27, 2010

How to use Intent to pass object ?

During my eZeditor app development I figured out how to pass an object using intent from one activity to another.

  1. If you want to pass an Object ( from one activity to another.
  2. The should implement android.os.Parcelable interface.
  3. Before you say startActivity(intent) on the source activity to navigate.
  4. Say intent.putExtra("com.ez.editor.note", note); where note is an object.
  5. 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.Creator CREATOR = new Parcelable.Creator() {

public Note createFromParcel(Parcel in) {
return new Note(in);

public void writeToParcel(Parcel out, int flags) {

public Note[] newArray(int size) {
return new Note[size];


1 comment:

javin paul said...

Good stuff dude keep it up.

deadlock in java