public class ParcelableContext { private Context mVal; public ParcelableContext(Context val) { System.out.println("PARCELABLE CONSTRUCTOR"); mVal = val; } public static final Parcelable.Creator<parcelablecontext> CREATOR = new Parcelable.Creator<parcelablecontext>() { public ParcelableContext createFromParcel(Parcel in) { System.out.println("PARCELABLE INSIDE"); Object obj = in.readValue(ParcelableContext.class.getClassLoader()); if(obj==null) System.out.println("PARCELABLE object is NULL"); else System.out.println("PARCELABLE object is not NULL"); Context s = (Context) obj; if(s==null) System.out.println("PARCELABLE s is NULL"); else System.out.println("PARCELABLE s is not NULL"); return new ParcelableContext(s); } public ParcelableContext[] newArray(int size) { return new ParcelableContext[size]; } }; public Context getValue() { System.out.println("PARCELABLE GET VALUE"); return mVal; } public String toString() { return "MyParcelable[val=" + mVal.toString() + "]"; } public int describeContents() { // TODO Auto-generated method stub return 0; } public void writeToParcel(Parcel dest, int flags) { // TODO Auto-generated method stub System.out.println("PARCELABLE WRITE"); dest.writeValue(mVal); } } </parcelablecontext></parcelablecontext>
Intent i = new Intent(this, SelectAbonent.class); Parcelable p = (ParcelableContext) new ParcelableContext(this); //Error i.putExtra("ParcelableContext",p);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)