Import Android.os.Parcel;
Import android.os.Parcelable;
public class person implements parcelable{
Private Integer ID;
private String name;
Private String Pass;
Public person () {
Super ();
}
Public person (Integer ID, string name, String pass) {
Super ();
This.id = ID;
THIS.name = name;
This.pass = pass;
}
Public Integer getId () {
return ID;
}
public void SetId (Integer id) {
This.id = ID;
}
Public String GetName () {
return name;
}
public void SetName (String name) {
THIS.name = name;
}
Public String Getpass () {
return pass;
}
public void SetPass (String pass) {
This.pass = pass;
}
@Override
public int hashcode () {
final int prime = 31;
int result = 1;
result = Prime * result + ((name = = null)? 0:name.hashcode ());
result = Prime * result + ((pass = = null)? 0:pass.hashcode ());
return result;
}
@Override
public boolean equals (Object o) {
if (this = = O) {
return true;
}
if (o = = null) {
return false;
}
if (getclass () = O.getclass ()) {
return false;
}
person other = (person) o;
if (name = = null) {
if (other.name! = null) {
return false;
}
}else if (!name.equals (Other.name)) {
return false;
}
if (pass = = null) {
if (other.pass! = null) {
return false;
}
}else if (!pass.equals (Other.pass)) {
return false;
}
return true;
}
Methods to implement the Parcelable interface
@Override
public int describecontents () {
return 0;
}
Methods to implement the Parcelable interface
@Override
public void Writetoparcel (Parcel dest, int flags) {
Write the data contained in the object to parcel
Dest.writeint (ID);
Dest.writestring (name);
Dest.writestring (pass);
}
Add a static member named Creator. The object implements the Parcelable.creator interface
public static final Parcelable.creator<person> Creator
= new Parcelable.creator<person> () {
@Override
Public person[] NewArray (int size) {
return new Person[size];
}
@Override
Public person Createfromparcel (Parcel source) {
Reads data from parcel, returns the person object
return new Person (Source.readint (),
Source.readstring (), source.readstring ());
}
};
}
Android calls remote service parameters and return values are required to implement the Parcelable interface