So the case is i want to send data from one activity to another with the help of ArrayList of objects. Below is the class code which i want to use as object. So please tell me that where i am going wrong.
class UserData implements Parcelable{
private String name, phone, city, username, password;
private String userDetails[];
private UserData(Parcel in){
city = in.readString();
name = in.readString();
password = in.readString();
phone = in.readString();
username = in.readString();
}
@Override
public int describeContents() {
// TODO Auto-generated method stub
return 0;
}
@Override
public void writeToParcel(Parcel out, int flags) {
// TODO Auto-generated method stub
out.writeStringArray(getDetails());
}
public static final Parcelable.Creator<UserData> CREATOR = new Parcelable.Creator<UserData>() {
public UserData createFromParcel(Parcel in){
return new UserData(in);
}
@Override
public UserData[] newArray(int size) {
// TODO Auto-generated method stub
return new UserData[size];
}
};
/*set method to set all the data that will be taken from the edit texts*/
public UserData(String n, long p, String c, String user, String pass){
name = n;
phone = Long.valueOf(p).toString();
city = c;
username = user;
password = pass;
}
/*get method to retrieve data in others activities such as signin and detailspage*/
String[] getDetails(){
userDetails = new String[]{name, phone, city, username, password};
return userDetails;
}
}