Public class immessage implements parcelable, comparable <immessage> {public static final string immessage_key = "immessage. key "; public static final string key_time =" immessage. time "; public static final int success = 0; public static final int error = 1; private int type; private string content; private string time; private string fromsubjid; private int msgtype = 0; // 0: accept 1: Send public immessage () {This. type = success;} public int GetType () {return type;} public void settype (INT type) {This. type = type;} Public String getcontent () {return content;} public void setcontent (string content) {This. content = content;} Public String gettime () {return time;} public void settime (string time) {This. time = time;} Public String getfromsubjid () {return fromsubjid;} public void setfromsubjid (string fromsubjid) {This. fromsubjid = fromsubjid;} public int getmsgtype () {return msgtype;} public void setmsgtype (INT msgtype) {This. msgtype = msgtype ;}@ overridepublic int describecontents () {return 0 ;}@ overridepublic void writetoparcel (parcel DEST, int flags) {DeST. writeint (type); DeST. writestring (content); DeST. writestring (time); DeST. writestring (fromsubjid); DeST. writeint (msgtype);} public static final parcelable. creator <immessage> creator = new parcelable. creator <immessage> () {@ overridepublic immessage createfromparcel (parcel source) {immessage message = new immessage (); message. settype (source. readint (); message. setcontent (source. readstring (); message. settime (source. readstring (); message. setfromsubjid (source. readstring (); message. setmsgtype (source. readint (); return message;} @ overridepublic immessage [] newarray (INT size) {return New immessage [size] ;}; public immessage (string content, string time, string withsb, int msgtype) {super (); this. content = content; this. time = time; this. msgtype = msgtype; this. fromsubjid = withsb;} @ overridepublic int compareto (immessage OTH) {If (null = This. gettime () | null = oth. gettime () {return 0;} string time1 = ""; string time2 = ""; time1 = This. gettime (); time2 = oth. gettime (); Return time1.compareto (time2 );}}