have you considered using bundles to pass data in intents,here is what you have to do
create a Parcelable class
add it to bundle object and add the object to
the intent that creates the final activity
receive the bundles object from the new
activity
here is an example of a Parcelable class
public class calender implements
Parcelable
{
private String date;
private String time;
protected calender(Parcel in) {
date = in.readString();
time = in.readString();
}
public static final Creator<calender>
CREATOR
= new Creator<calender>() {
@Override
public calender createFromParcel(Parcel
in) {
return new calender(in);
}
@Override
public calender[] newArray(int size) {
return new calender[size];
}
};
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int
flags) {
dest.writeString(date);
dest.writeString(time);
}
}
and here is how you send the parceble class using
intent
Intent intent=new
Intent(CurrentActivty.this,
finalActivty.class);
calender calender=new calender();
calender.setDate("example date");
calender.setTime("example time");
Bundle bundle=new Bundle();
bundle.putParcelable("data",calender);
intent.putExtra("calenderData",bundle);
startActivity(intent);
and then finally you receive the intent data in your onCreate method
if (getIntent().getBundleExtra("calenderData")!=null)
{
calender calender =getIntent().getBundleExtra("calenderData").getParcelable("data");
//do something with the calender variable
}
here is documentation on class bundle