Package com. hzhi. my_sax; import java. util. arrayList; import android. OS. parcel; import android. OS. parcelable; public class school implements Parcelable {public static final String tag_name = "School"; public String name; public String code; public ArrayList <major> majors; public static final Parcelable. creator <school> CREATOR = new Parcelable. creator <school> () {@ Overridepublic school createFromParcel (Parcel in) {// TODO Auto-generated method stubreturn new school (in );} @ Overridepublic school [] newArray (int size) {// TODO Auto-generated method stubreturn new school [size] ;};@ Overridepublic int describeContents () {// TODO Auto-generated method stubreturn 0;} @ Overridepublic void writeToParcel (Parcel arg0, int arg1) {// TODO Auto-generated method stub} // implement Parcelable interface public school (Parcel in) {this. name = in. readString (); this. code = in. readString () ;}// constructor public school (String name, String code) {this. name = name; this. code = code; this. majors = new ArrayList <major> () ;}// Add a professional public void add_major (major m) {this. majors. add (m);} // returns the professional public ArrayList <major> get_majors () {return this. majors;} // rewrite toStringpublic String toString () {// TODO Auto-generated method stubreturn (getName ();} public String getName () {if (this. name = null) {return ("(Default)");} return (this. name );}}
Package com. hzhi. my_sax; import java. util. arrayList; import android. OS. parcel; import android. OS. parcelable; public class major implements Parcelable {public static final String tag_name = "Major"; public String name; public String code; public ArrayList <clas> clases; public static final Parcelable. creator <major> CREATOR = new Parcelable. creator <major> () {@ Overridepublic major createFromParcel (Parcel in) {// TODO Auto-generated method stubreturn new major (in );} @ Overridepublic major [] newArray (int size) {// TODO Auto-generated method stubreturn new major [size] ;}}; @ Overridepublic int describeContents () {// TODO Auto-generated method stubreturn 0;} @ Overridepublic void writeToParcel (Parcel dest, int flags) {// TODO Auto-generated method stubdest. writeString (this. name); dest. writeString (this. code);} // implement the Parcelable interface public major (Parcel in) {this. name = in. readString (); this. code = in. readString () ;}// constructor public major (String name, String code) {this. name = name; this. code = code; this. clases = new ArrayList <clas> ();} public String getCode () {return (this. code);} public void add_clas (clas c) {this. clases. add (c);} public ArrayList <clas> get_clases () {return this. clases;} // rewrite toStringpublic String toString () {// TODO Auto-generated method stubreturn (getName ();} public String getName () {if (this. name = null) {return ("(Default)");} return (this. name );}}
Package com. hzhi. my_sax; import android. OS. parcel; import android. OS. parcelable; public class clas implements Parcelable {public static final String tag_name = "Class"; public String name; public String code; public static final Parcelable. creator <clas> CREATOR = new Parcelable. creator <clas> () {@ Overridepublic clas createFromParcel (Parcel in) {// TODO Auto-generated method stubreturn new clas (in );} @ Overridepublic clas [] newArray (int size) {// TODO Auto-generated method stubreturn new clas [size] ;};@ Overridepublic int describeContents () {// TODO Auto-generated method stubreturn 0;} @ Overridepublic void writeToParcel (Parcel dest, int flags) {// TODO Auto-generated method stubdest. writeString (this. name); dest. writeString (this. code);} public clas (Parcel in) {this. name = in. readString (); this. code = in. readString ();} public clas (final String name, final String code) {this. name = name; this. code = code;} // rewrite toStringpublic String toString () {// TODO Auto-generated method stubreturn (getName ();} public String getName () {if (this. name = null) {return ("(Default)");} return (this. name );}}