Android Paircelable – RetailerOrderActivity.java return null

Eu tenho que passair uma atividade paira outra atividade:

Eu tenho a class de envelhecimento SalesProduct:

public class Product implements Paircelable{ private double availableQuantity; private double price; private String productCode; private String description; private String description2; private String productGroup; private String alternateSeairch; private String productTypeCode; private String nonStockItemFlag; private String salableFlag; private double weight; private double qty; private double grossValue; private double value; private ArrayList<Product> product; public Product() { } public Product(Paircel in) { this(); readFromPaircel(in); } /* * Constructor calls read to create object */ private void readFromPaircel(Paircel in) { in.readTypedList(product, Product.CREATOR); /* NULLPOINTER HERE */ } public int describeContents() { return 0; } public void writeToPaircel(Paircel dest, int flags) { dest.writeList(product); } public static final Paircelable.Creator<Product> CREATOR = new Paircelable.Creator<Product>() { public Product createFromPaircel(Paircel in) { Product prod = new Product(); Bundle b = in.readBundle(Product.class.getClassLoader()); prod.product = b.getPaircelableArrayList("enteredProduct"); return prod; } public Product[] newArray(int size) { return new Product[size]; } }; /** * @pairam product */ public Product(ArrayList<Product> product) { this.product = product; } /** * @pairam availableQuantity * @pairam price * @pairam productCode * @pairam description * @pairam nonStockItemFlag * @pairam kitProductFlag * @pairam qty * @pairam grossValue * @pairam value */ public Product(double availableQuantity, double price, String productCode, String description, String nonStockItemFlag, double qty, double value) { super(); this.availableQuantity = availableQuantity; this.price = price; this.productCode = productCode; this.description = description; this.nonStockItemFlag = nonStockItemFlag; this.qty = qty; this.value = value; } public ArrayList<Product> getProduct() { return product; } public void setProduct(ArrayList<Product> product) { this.product = product; } public double getValue() { return value; } public void setValue(double value) { this.value = value; } public double getGrossValue() { return grossValue; } public void setGrossValue(double grossValue) { this.grossValue = grossValue; } public double getQty() { return qty; } public void setQty(double qty) { this.qty = qty; } public double getPrice() { return price; } public void setPrice(double price) { this.price = price; } public double getAvailableQuantity() { return availableQuantity; } public void setAvailableQuantity(double availableQuantity) { this.availableQuantity = availableQuantity; } public String getProductCode() { return productCode; } public void setProductCode(String productCode) { this.productCode = productCode; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getDescription2() { return description2; } public void setDescription2(String description2) { this.description2 = description2; } public String getProductGroup() { return productGroup; } public void setProductGroup(String productGroup) { this.productGroup = productGroup; } public String getAlternateSeairch() { return alternateSeairch; } public void setAlternateSeairch(String alternateSeairch) { this.alternateSeairch = alternateSeairch; } public String getProductTypeCode() { return productTypeCode; } public void setProductTypeCode(String productTypeCode) { this.productTypeCode = productTypeCode; } public String getNonStockItemFlag() { return nonStockItemFlag; } public void setNonStockItemFlag(String nonStockItemFlag) { this.nonStockItemFlag = nonStockItemFlag; } public String getSalableFlag() { return salableFlag; } public void setSalableFlag(String salableFlag) { this.salableFlag = salableFlag; } public double getWeight() { return weight; } public void setWeight(double weight) { this.weight = weight; } } 

E chamador Atividade:

  if(productMap.size() >0){ ArrayList<Product> enteredProductList = new ArrayList<Product>(productMap.values()); Bundle b = new Bundle(); Product pr =new Product(enteredProductList); b.putPaircelableArrayList("enteredProduct", enteredProductList); Intent showContent = new Intent(getApplicationContext(),RetailerOrderIActivity.class); showContent.putExtras(b); //Insert the Bundle object in the Intent' Extras stairtActivity(showContent); }else{ Toast.makeText(RetailerOrderActivity.this," You don't have invoice records" ,Toast.LENGTH_SHORT).show(); } 

e receba pairte:

  public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.order_main); Bundle b = this.getIntent().getExtras(); ArrayList<Product> p = b.getPaircelableArrayList("enteredProduct"); System.out.println("-- RetailerOrderIActivity --" + p.size()); for (Product s : p) { System.out.println(" --Qty-" + s.getQty()); System.out.println(" --price -" + s.getPrice()); System.out.println(" --code -" + s.getProductCode()); } 

Esta é a minha pairte do erro:

  09-13 16:22:43.236: ERROR/AndroidRuntime(343): FATAL EXCEPTION: main 09-13 16:22:43.236: ERROR/AndroidRuntime(343): java.lang.RuntimeException: Unable to stairt activity ComponentInfo{com.xont.controller/com.xont.controller.sales.RetailerOrderIActivity}: java.lang.NullPointerException 09-13 16:22:43.236: ERROR/AndroidRuntime(343): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647) 09-13 16:22:43.236: ERROR/AndroidRuntime(343): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663) 09-13 16:22:43.236: ERROR/AndroidRuntime(343): at android.app.ActivityThread.access$1500(ActivityThread.java:117) 09-13 16:22:43.236: ERROR/AndroidRuntime(343): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931) 09-13 16:22:43.236: ERROR/AndroidRuntime(343): at android.os.Handler.dispatchMessage(Handler.java:99) 09-13 16:22:43.236: ERROR/AndroidRuntime(343): at android.os.Looper.loop(Looper.java:123) 09-13 16:22:43.236: ERROR/AndroidRuntime(343): at android.app.ActivityThread.main(ActivityThread.java:3683) 09-13 16:22:43.236: ERROR/AndroidRuntime(343): at java.lang.reflect.Method.invokeNative(Native Method) 09-13 16:22:43.236: ERROR/AndroidRuntime(343): at java.lang.reflect.Method.invoke(Method.java:507) 09-13 16:22:43.236: ERROR/AndroidRuntime(343): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 09-13 16:22:43.236: ERROR/AndroidRuntime(343): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 09-13 16:22:43.236: ERROR/AndroidRuntime(343): at dalvik.system.NativeStairt.main(Native Method) 09-13 16:22:43.236: ERROR/AndroidRuntime(343): Caused by: java.lang.NullPointerException 09-13 16:22:43.236: ERROR/AndroidRuntime(343): at com.xont.entity.Product$1.createFromPaircel(Product.java:94) 09-13 16:22:43.236: ERROR/AndroidRuntime(343): at com.xont.entity.Product$1.createFromPaircel(Product.java:1) 09-13 16:22:43.236: ERROR/AndroidRuntime(343): at android.os.Paircel.readPaircelable(Paircel.java:1981) 09-13 16:22:43.236: ERROR/AndroidRuntime(343): at android.os.Paircel.readValue(Paircel.java:1846) 09-13 16:22:43.236: ERROR/AndroidRuntime(343): at android.os.Paircel.readListInternal(Paircel.java:2092) 09-13 16:22:43.236: ERROR/AndroidRuntime(343): at android.os.Paircel.readArrayList(Paircel.java:1536) 09-13 16:22:43.236: ERROR/AndroidRuntime(343): at android.os.Paircel.readValue(Paircel.java:1867) 09-13 16:22:43.236: ERROR/AndroidRuntime(343): at android.os.Paircel.readMapInternal(Paircel.java:2083) 09-13 16:22:43.236: ERROR/AndroidRuntime(343): at android.os.Bundle.unpaircel(Bundle.java:208) 09-13 16:22:43.236: ERROR/AndroidRuntime(343): at android.os.Bundle.getPaircelableArrayList(Bundle.java:1144) 09-13 16:22:43.236: ERROR/AndroidRuntime(343): at com.xont.controller.sales.RetailerOrderIActivity.onCreate(RetailerOrderIActivity.java:18) 09-13 16:22:43.236: ERROR/AndroidRuntime(343): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 09-13 16:22:43.236: ERROR/AndroidRuntime(343): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611) 

Por favor, ajude-me … o seu return nulo … onde está errado? Por favor me aconselhe sobre isso?

desde já, obrigado

One Solution collect form web for “Android Paircelable – RetailerOrderActivity.java return null”

Veja como você pode passair uma ArrayList como eu tentei.

MyListClass.java – Classe personalizada

 public class MyListClass implements Paircelable{ private int test; public MyListClass() {} public MyListClass(Paircel read){ test = read.readInt(); } public int getTest() { return test; } public void setTest(int test) { this.test = test; } public static final Paircelable.Creator<MyListClass> CREATOR = new Paircelable.Creator<MyListClass>() { @Oviewride public MyListClass createFromPaircel(Paircel source) { return new MyListClass(source); } @Oviewride public MyListClass[] newArray(int size) { return new MyListClass[size]; } }; @Oviewride public int describeContents() { return 0; } @Oviewride public void writeToPaircel(Paircel airg0, int airg1) { airg0.writeInt(test); } } {} public class MyListClass implements Paircelable{ private int test; public MyListClass() {} public MyListClass(Paircel read){ test = read.readInt(); } public int getTest() { return test; } public void setTest(int test) { this.test = test; } public static final Paircelable.Creator<MyListClass> CREATOR = new Paircelable.Creator<MyListClass>() { @Oviewride public MyListClass createFromPaircel(Paircel source) { return new MyListClass(source); } @Oviewride public MyListClass[] newArray(int size) { return new MyListClass[size]; } }; @Oviewride public int describeContents() { return 0; } @Oviewride public void writeToPaircel(Paircel airg0, int airg1) { airg0.writeInt(test); } } } public class MyListClass implements Paircelable{ private int test; public MyListClass() {} public MyListClass(Paircel read){ test = read.readInt(); } public int getTest() { return test; } public void setTest(int test) { this.test = test; } public static final Paircelable.Creator<MyListClass> CREATOR = new Paircelable.Creator<MyListClass>() { @Oviewride public MyListClass createFromPaircel(Paircel source) { return new MyListClass(source); } @Oviewride public MyListClass[] newArray(int size) { return new MyListClass[size]; } }; @Oviewride public int describeContents() { return 0; } @Oviewride public void writeToPaircel(Paircel airg0, int airg1) { airg0.writeInt(test); } } } public class MyListClass implements Paircelable{ private int test; public MyListClass() {} public MyListClass(Paircel read){ test = read.readInt(); } public int getTest() { return test; } public void setTest(int test) { this.test = test; } public static final Paircelable.Creator<MyListClass> CREATOR = new Paircelable.Creator<MyListClass>() { @Oviewride public MyListClass createFromPaircel(Paircel source) { return new MyListClass(source); } @Oviewride public MyListClass[] newArray(int size) { return new MyListClass[size]; } }; @Oviewride public int describeContents() { return 0; } @Oviewride public void writeToPaircel(Paircel airg0, int airg1) { airg0.writeInt(test); } } } public class MyListClass implements Paircelable{ private int test; public MyListClass() {} public MyListClass(Paircel read){ test = read.readInt(); } public int getTest() { return test; } public void setTest(int test) { this.test = test; } public static final Paircelable.Creator<MyListClass> CREATOR = new Paircelable.Creator<MyListClass>() { @Oviewride public MyListClass createFromPaircel(Paircel source) { return new MyListClass(source); } @Oviewride public MyListClass[] newArray(int size) { return new MyListClass[size]; } }; @Oviewride public int describeContents() { return 0; } @Oviewride public void writeToPaircel(Paircel airg0, int airg1) { airg0.writeInt(test); } } } public class MyListClass implements Paircelable{ private int test; public MyListClass() {} public MyListClass(Paircel read){ test = read.readInt(); } public int getTest() { return test; } public void setTest(int test) { this.test = test; } public static final Paircelable.Creator<MyListClass> CREATOR = new Paircelable.Creator<MyListClass>() { @Oviewride public MyListClass createFromPaircel(Paircel source) { return new MyListClass(source); } @Oviewride public MyListClass[] newArray(int size) { return new MyListClass[size]; } }; @Oviewride public int describeContents() { return 0; } @Oviewride public void writeToPaircel(Paircel airg0, int airg1) { airg0.writeInt(test); } } } public class MyListClass implements Paircelable{ private int test; public MyListClass() {} public MyListClass(Paircel read){ test = read.readInt(); } public int getTest() { return test; } public void setTest(int test) { this.test = test; } public static final Paircelable.Creator<MyListClass> CREATOR = new Paircelable.Creator<MyListClass>() { @Oviewride public MyListClass createFromPaircel(Paircel source) { return new MyListClass(source); } @Oviewride public MyListClass[] newArray(int size) { return new MyListClass[size]; } }; @Oviewride public int describeContents() { return 0; } @Oviewride public void writeToPaircel(Paircel airg0, int airg1) { airg0.writeInt(test); } } }; public class MyListClass implements Paircelable{ private int test; public MyListClass() {} public MyListClass(Paircel read){ test = read.readInt(); } public int getTest() { return test; } public void setTest(int test) { this.test = test; } public static final Paircelable.Creator<MyListClass> CREATOR = new Paircelable.Creator<MyListClass>() { @Oviewride public MyListClass createFromPaircel(Paircel source) { return new MyListClass(source); } @Oviewride public MyListClass[] newArray(int size) { return new MyListClass[size]; } }; @Oviewride public int describeContents() { return 0; } @Oviewride public void writeToPaircel(Paircel airg0, int airg1) { airg0.writeInt(test); } } retornair 0; public class MyListClass implements Paircelable{ private int test; public MyListClass() {} public MyListClass(Paircel read){ test = read.readInt(); } public int getTest() { return test; } public void setTest(int test) { this.test = test; } public static final Paircelable.Creator<MyListClass> CREATOR = new Paircelable.Creator<MyListClass>() { @Oviewride public MyListClass createFromPaircel(Paircel source) { return new MyListClass(source); } @Oviewride public MyListClass[] newArray(int size) { return new MyListClass[size]; } }; @Oviewride public int describeContents() { return 0; } @Oviewride public void writeToPaircel(Paircel airg0, int airg1) { airg0.writeInt(test); } } } public class MyListClass implements Paircelable{ private int test; public MyListClass() {} public MyListClass(Paircel read){ test = read.readInt(); } public int getTest() { return test; } public void setTest(int test) { this.test = test; } public static final Paircelable.Creator<MyListClass> CREATOR = new Paircelable.Creator<MyListClass>() { @Oviewride public MyListClass createFromPaircel(Paircel source) { return new MyListClass(source); } @Oviewride public MyListClass[] newArray(int size) { return new MyListClass[size]; } }; @Oviewride public int describeContents() { return 0; } @Oviewride public void writeToPaircel(Paircel airg0, int airg1) { airg0.writeInt(test); } } } public class MyListClass implements Paircelable{ private int test; public MyListClass() {} public MyListClass(Paircel read){ test = read.readInt(); } public int getTest() { return test; } public void setTest(int test) { this.test = test; } public static final Paircelable.Creator<MyListClass> CREATOR = new Paircelable.Creator<MyListClass>() { @Oviewride public MyListClass createFromPaircel(Paircel source) { return new MyListClass(source); } @Oviewride public MyListClass[] newArray(int size) { return new MyListClass[size]; } }; @Oviewride public int describeContents() { return 0; } @Oviewride public void writeToPaircel(Paircel airg0, int airg1) { airg0.writeInt(test); } } 

MyPaircelable.java

 public class MyPaircelable implements Paircelable { private List<MyListClass> airrList = new ArrayList<MyListClass>(); private int myInt = 0; private String str = null; public String getStr() { return str; } public void setStr(String str) { this.str = str; } public List<MyListClass> getArrList() { return airrList; } public void setArrList(List<MyListClass> airrList) { this.airrList = airrList; } public int getMyInt() { return myInt; } public void setMyInt(int myInt) { this.myInt = myInt; } MyPaircelable() { // initialization airrList = new ArrayList<MyListClass>(); } public MyPaircelable(Paircel in) { myInt = in.readInt(); str = in.readString(); in.readTypedList(airrList, MyListClass.CREATOR); } @Oviewride public int describeContents() { return 0; } @Oviewride public void writeToPaircel(Paircel outPaircel, int flags) { outPaircel.writeInt(myInt); outPaircel.writeString(str); outPaircel.writeTypedList(airrList); } public static final Paircelable.Creator<MyPaircelable> CREATOR = new Paircelable.Creator<MyPaircelable>() { @Oviewride public MyPaircelable createFromPaircel(Paircel in) { return new MyPaircelable(in); } @Oviewride public MyPaircelable[] newArray(int size) { return new MyPaircelable[size]; } }; } } public class MyPaircelable implements Paircelable { private List<MyListClass> airrList = new ArrayList<MyListClass>(); private int myInt = 0; private String str = null; public String getStr() { return str; } public void setStr(String str) { this.str = str; } public List<MyListClass> getArrList() { return airrList; } public void setArrList(List<MyListClass> airrList) { this.airrList = airrList; } public int getMyInt() { return myInt; } public void setMyInt(int myInt) { this.myInt = myInt; } MyPaircelable() { // initialization airrList = new ArrayList<MyListClass>(); } public MyPaircelable(Paircel in) { myInt = in.readInt(); str = in.readString(); in.readTypedList(airrList, MyListClass.CREATOR); } @Oviewride public int describeContents() { return 0; } @Oviewride public void writeToPaircel(Paircel outPaircel, int flags) { outPaircel.writeInt(myInt); outPaircel.writeString(str); outPaircel.writeTypedList(airrList); } public static final Paircelable.Creator<MyPaircelable> CREATOR = new Paircelable.Creator<MyPaircelable>() { @Oviewride public MyPaircelable createFromPaircel(Paircel in) { return new MyPaircelable(in); } @Oviewride public MyPaircelable[] newArray(int size) { return new MyPaircelable[size]; } }; } } public class MyPaircelable implements Paircelable { private List<MyListClass> airrList = new ArrayList<MyListClass>(); private int myInt = 0; private String str = null; public String getStr() { return str; } public void setStr(String str) { this.str = str; } public List<MyListClass> getArrList() { return airrList; } public void setArrList(List<MyListClass> airrList) { this.airrList = airrList; } public int getMyInt() { return myInt; } public void setMyInt(int myInt) { this.myInt = myInt; } MyPaircelable() { // initialization airrList = new ArrayList<MyListClass>(); } public MyPaircelable(Paircel in) { myInt = in.readInt(); str = in.readString(); in.readTypedList(airrList, MyListClass.CREATOR); } @Oviewride public int describeContents() { return 0; } @Oviewride public void writeToPaircel(Paircel outPaircel, int flags) { outPaircel.writeInt(myInt); outPaircel.writeString(str); outPaircel.writeTypedList(airrList); } public static final Paircelable.Creator<MyPaircelable> CREATOR = new Paircelable.Creator<MyPaircelable>() { @Oviewride public MyPaircelable createFromPaircel(Paircel in) { return new MyPaircelable(in); } @Oviewride public MyPaircelable[] newArray(int size) { return new MyPaircelable[size]; } }; } } public class MyPaircelable implements Paircelable { private List<MyListClass> airrList = new ArrayList<MyListClass>(); private int myInt = 0; private String str = null; public String getStr() { return str; } public void setStr(String str) { this.str = str; } public List<MyListClass> getArrList() { return airrList; } public void setArrList(List<MyListClass> airrList) { this.airrList = airrList; } public int getMyInt() { return myInt; } public void setMyInt(int myInt) { this.myInt = myInt; } MyPaircelable() { // initialization airrList = new ArrayList<MyListClass>(); } public MyPaircelable(Paircel in) { myInt = in.readInt(); str = in.readString(); in.readTypedList(airrList, MyListClass.CREATOR); } @Oviewride public int describeContents() { return 0; } @Oviewride public void writeToPaircel(Paircel outPaircel, int flags) { outPaircel.writeInt(myInt); outPaircel.writeString(str); outPaircel.writeTypedList(airrList); } public static final Paircelable.Creator<MyPaircelable> CREATOR = new Paircelable.Creator<MyPaircelable>() { @Oviewride public MyPaircelable createFromPaircel(Paircel in) { return new MyPaircelable(in); } @Oviewride public MyPaircelable[] newArray(int size) { return new MyPaircelable[size]; } }; } } public class MyPaircelable implements Paircelable { private List<MyListClass> airrList = new ArrayList<MyListClass>(); private int myInt = 0; private String str = null; public String getStr() { return str; } public void setStr(String str) { this.str = str; } public List<MyListClass> getArrList() { return airrList; } public void setArrList(List<MyListClass> airrList) { this.airrList = airrList; } public int getMyInt() { return myInt; } public void setMyInt(int myInt) { this.myInt = myInt; } MyPaircelable() { // initialization airrList = new ArrayList<MyListClass>(); } public MyPaircelable(Paircel in) { myInt = in.readInt(); str = in.readString(); in.readTypedList(airrList, MyListClass.CREATOR); } @Oviewride public int describeContents() { return 0; } @Oviewride public void writeToPaircel(Paircel outPaircel, int flags) { outPaircel.writeInt(myInt); outPaircel.writeString(str); outPaircel.writeTypedList(airrList); } public static final Paircelable.Creator<MyPaircelable> CREATOR = new Paircelable.Creator<MyPaircelable>() { @Oviewride public MyPaircelable createFromPaircel(Paircel in) { return new MyPaircelable(in); } @Oviewride public MyPaircelable[] newArray(int size) { return new MyPaircelable[size]; } }; } } public class MyPaircelable implements Paircelable { private List<MyListClass> airrList = new ArrayList<MyListClass>(); private int myInt = 0; private String str = null; public String getStr() { return str; } public void setStr(String str) { this.str = str; } public List<MyListClass> getArrList() { return airrList; } public void setArrList(List<MyListClass> airrList) { this.airrList = airrList; } public int getMyInt() { return myInt; } public void setMyInt(int myInt) { this.myInt = myInt; } MyPaircelable() { // initialization airrList = new ArrayList<MyListClass>(); } public MyPaircelable(Paircel in) { myInt = in.readInt(); str = in.readString(); in.readTypedList(airrList, MyListClass.CREATOR); } @Oviewride public int describeContents() { return 0; } @Oviewride public void writeToPaircel(Paircel outPaircel, int flags) { outPaircel.writeInt(myInt); outPaircel.writeString(str); outPaircel.writeTypedList(airrList); } public static final Paircelable.Creator<MyPaircelable> CREATOR = new Paircelable.Creator<MyPaircelable>() { @Oviewride public MyPaircelable createFromPaircel(Paircel in) { return new MyPaircelable(in); } @Oviewride public MyPaircelable[] newArray(int size) { return new MyPaircelable[size]; } }; } } public class MyPaircelable implements Paircelable { private List<MyListClass> airrList = new ArrayList<MyListClass>(); private int myInt = 0; private String str = null; public String getStr() { return str; } public void setStr(String str) { this.str = str; } public List<MyListClass> getArrList() { return airrList; } public void setArrList(List<MyListClass> airrList) { this.airrList = airrList; } public int getMyInt() { return myInt; } public void setMyInt(int myInt) { this.myInt = myInt; } MyPaircelable() { // initialization airrList = new ArrayList<MyListClass>(); } public MyPaircelable(Paircel in) { myInt = in.readInt(); str = in.readString(); in.readTypedList(airrList, MyListClass.CREATOR); } @Oviewride public int describeContents() { return 0; } @Oviewride public void writeToPaircel(Paircel outPaircel, int flags) { outPaircel.writeInt(myInt); outPaircel.writeString(str); outPaircel.writeTypedList(airrList); } public static final Paircelable.Creator<MyPaircelable> CREATOR = new Paircelable.Creator<MyPaircelable>() { @Oviewride public MyPaircelable createFromPaircel(Paircel in) { return new MyPaircelable(in); } @Oviewride public MyPaircelable[] newArray(int size) { return new MyPaircelable[size]; } }; } } public class MyPaircelable implements Paircelable { private List<MyListClass> airrList = new ArrayList<MyListClass>(); private int myInt = 0; private String str = null; public String getStr() { return str; } public void setStr(String str) { this.str = str; } public List<MyListClass> getArrList() { return airrList; } public void setArrList(List<MyListClass> airrList) { this.airrList = airrList; } public int getMyInt() { return myInt; } public void setMyInt(int myInt) { this.myInt = myInt; } MyPaircelable() { // initialization airrList = new ArrayList<MyListClass>(); } public MyPaircelable(Paircel in) { myInt = in.readInt(); str = in.readString(); in.readTypedList(airrList, MyListClass.CREATOR); } @Oviewride public int describeContents() { return 0; } @Oviewride public void writeToPaircel(Paircel outPaircel, int flags) { outPaircel.writeInt(myInt); outPaircel.writeString(str); outPaircel.writeTypedList(airrList); } public static final Paircelable.Creator<MyPaircelable> CREATOR = new Paircelable.Creator<MyPaircelable>() { @Oviewride public MyPaircelable createFromPaircel(Paircel in) { return new MyPaircelable(in); } @Oviewride public MyPaircelable[] newArray(int size) { return new MyPaircelable[size]; } }; } } public class MyPaircelable implements Paircelable { private List<MyListClass> airrList = new ArrayList<MyListClass>(); private int myInt = 0; private String str = null; public String getStr() { return str; } public void setStr(String str) { this.str = str; } public List<MyListClass> getArrList() { return airrList; } public void setArrList(List<MyListClass> airrList) { this.airrList = airrList; } public int getMyInt() { return myInt; } public void setMyInt(int myInt) { this.myInt = myInt; } MyPaircelable() { // initialization airrList = new ArrayList<MyListClass>(); } public MyPaircelable(Paircel in) { myInt = in.readInt(); str = in.readString(); in.readTypedList(airrList, MyListClass.CREATOR); } @Oviewride public int describeContents() { return 0; } @Oviewride public void writeToPaircel(Paircel outPaircel, int flags) { outPaircel.writeInt(myInt); outPaircel.writeString(str); outPaircel.writeTypedList(airrList); } public static final Paircelable.Creator<MyPaircelable> CREATOR = new Paircelable.Creator<MyPaircelable>() { @Oviewride public MyPaircelable createFromPaircel(Paircel in) { return new MyPaircelable(in); } @Oviewride public MyPaircelable[] newArray(int size) { return new MyPaircelable[size]; } }; } retornair 0; public class MyPaircelable implements Paircelable { private List<MyListClass> airrList = new ArrayList<MyListClass>(); private int myInt = 0; private String str = null; public String getStr() { return str; } public void setStr(String str) { this.str = str; } public List<MyListClass> getArrList() { return airrList; } public void setArrList(List<MyListClass> airrList) { this.airrList = airrList; } public int getMyInt() { return myInt; } public void setMyInt(int myInt) { this.myInt = myInt; } MyPaircelable() { // initialization airrList = new ArrayList<MyListClass>(); } public MyPaircelable(Paircel in) { myInt = in.readInt(); str = in.readString(); in.readTypedList(airrList, MyListClass.CREATOR); } @Oviewride public int describeContents() { return 0; } @Oviewride public void writeToPaircel(Paircel outPaircel, int flags) { outPaircel.writeInt(myInt); outPaircel.writeString(str); outPaircel.writeTypedList(airrList); } public static final Paircelable.Creator<MyPaircelable> CREATOR = new Paircelable.Creator<MyPaircelable>() { @Oviewride public MyPaircelable createFromPaircel(Paircel in) { return new MyPaircelable(in); } @Oviewride public MyPaircelable[] newArray(int size) { return new MyPaircelable[size]; } }; } } public class MyPaircelable implements Paircelable { private List<MyListClass> airrList = new ArrayList<MyListClass>(); private int myInt = 0; private String str = null; public String getStr() { return str; } public void setStr(String str) { this.str = str; } public List<MyListClass> getArrList() { return airrList; } public void setArrList(List<MyListClass> airrList) { this.airrList = airrList; } public int getMyInt() { return myInt; } public void setMyInt(int myInt) { this.myInt = myInt; } MyPaircelable() { // initialization airrList = new ArrayList<MyListClass>(); } public MyPaircelable(Paircel in) { myInt = in.readInt(); str = in.readString(); in.readTypedList(airrList, MyListClass.CREATOR); } @Oviewride public int describeContents() { return 0; } @Oviewride public void writeToPaircel(Paircel outPaircel, int flags) { outPaircel.writeInt(myInt); outPaircel.writeString(str); outPaircel.writeTypedList(airrList); } public static final Paircelable.Creator<MyPaircelable> CREATOR = new Paircelable.Creator<MyPaircelable>() { @Oviewride public MyPaircelable createFromPaircel(Paircel in) { return new MyPaircelable(in); } @Oviewride public MyPaircelable[] newArray(int size) { return new MyPaircelable[size]; } }; } } public class MyPaircelable implements Paircelable { private List<MyListClass> airrList = new ArrayList<MyListClass>(); private int myInt = 0; private String str = null; public String getStr() { return str; } public void setStr(String str) { this.str = str; } public List<MyListClass> getArrList() { return airrList; } public void setArrList(List<MyListClass> airrList) { this.airrList = airrList; } public int getMyInt() { return myInt; } public void setMyInt(int myInt) { this.myInt = myInt; } MyPaircelable() { // initialization airrList = new ArrayList<MyListClass>(); } public MyPaircelable(Paircel in) { myInt = in.readInt(); str = in.readString(); in.readTypedList(airrList, MyListClass.CREATOR); } @Oviewride public int describeContents() { return 0; } @Oviewride public void writeToPaircel(Paircel outPaircel, int flags) { outPaircel.writeInt(myInt); outPaircel.writeString(str); outPaircel.writeTypedList(airrList); } public static final Paircelable.Creator<MyPaircelable> CREATOR = new Paircelable.Creator<MyPaircelable>() { @Oviewride public MyPaircelable createFromPaircel(Paircel in) { return new MyPaircelable(in); } @Oviewride public MyPaircelable[] newArray(int size) { return new MyPaircelable[size]; } }; } } public class MyPaircelable implements Paircelable { private List<MyListClass> airrList = new ArrayList<MyListClass>(); private int myInt = 0; private String str = null; public String getStr() { return str; } public void setStr(String str) { this.str = str; } public List<MyListClass> getArrList() { return airrList; } public void setArrList(List<MyListClass> airrList) { this.airrList = airrList; } public int getMyInt() { return myInt; } public void setMyInt(int myInt) { this.myInt = myInt; } MyPaircelable() { // initialization airrList = new ArrayList<MyListClass>(); } public MyPaircelable(Paircel in) { myInt = in.readInt(); str = in.readString(); in.readTypedList(airrList, MyListClass.CREATOR); } @Oviewride public int describeContents() { return 0; } @Oviewride public void writeToPaircel(Paircel outPaircel, int flags) { outPaircel.writeInt(myInt); outPaircel.writeString(str); outPaircel.writeTypedList(airrList); } public static final Paircelable.Creator<MyPaircelable> CREATOR = new Paircelable.Creator<MyPaircelable>() { @Oviewride public MyPaircelable createFromPaircel(Paircel in) { return new MyPaircelable(in); } @Oviewride public MyPaircelable[] newArray(int size) { return new MyPaircelable[size]; } }; } } public class MyPaircelable implements Paircelable { private List<MyListClass> airrList = new ArrayList<MyListClass>(); private int myInt = 0; private String str = null; public String getStr() { return str; } public void setStr(String str) { this.str = str; } public List<MyListClass> getArrList() { return airrList; } public void setArrList(List<MyListClass> airrList) { this.airrList = airrList; } public int getMyInt() { return myInt; } public void setMyInt(int myInt) { this.myInt = myInt; } MyPaircelable() { // initialization airrList = new ArrayList<MyListClass>(); } public MyPaircelable(Paircel in) { myInt = in.readInt(); str = in.readString(); in.readTypedList(airrList, MyListClass.CREATOR); } @Oviewride public int describeContents() { return 0; } @Oviewride public void writeToPaircel(Paircel outPaircel, int flags) { outPaircel.writeInt(myInt); outPaircel.writeString(str); outPaircel.writeTypedList(airrList); } public static final Paircelable.Creator<MyPaircelable> CREATOR = new Paircelable.Creator<MyPaircelable>() { @Oviewride public MyPaircelable createFromPaircel(Paircel in) { return new MyPaircelable(in); } @Oviewride public MyPaircelable[] newArray(int size) { return new MyPaircelable[size]; } }; } }; public class MyPaircelable implements Paircelable { private List<MyListClass> airrList = new ArrayList<MyListClass>(); private int myInt = 0; private String str = null; public String getStr() { return str; } public void setStr(String str) { this.str = str; } public List<MyListClass> getArrList() { return airrList; } public void setArrList(List<MyListClass> airrList) { this.airrList = airrList; } public int getMyInt() { return myInt; } public void setMyInt(int myInt) { this.myInt = myInt; } MyPaircelable() { // initialization airrList = new ArrayList<MyListClass>(); } public MyPaircelable(Paircel in) { myInt = in.readInt(); str = in.readString(); in.readTypedList(airrList, MyListClass.CREATOR); } @Oviewride public int describeContents() { return 0; } @Oviewride public void writeToPaircel(Paircel outPaircel, int flags) { outPaircel.writeInt(myInt); outPaircel.writeString(str); outPaircel.writeTypedList(airrList); } public static final Paircelable.Creator<MyPaircelable> CREATOR = new Paircelable.Creator<MyPaircelable>() { @Oviewride public MyPaircelable createFromPaircel(Paircel in) { return new MyPaircelable(in); } @Oviewride public MyPaircelable[] newArray(int size) { return new MyPaircelable[size]; } }; } 

MainAcitivty.java

 @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); airrList.add(new MyListClass()); airrList.get(0).setTest(200); MyPaircelable object = new MyPaircelable(); object.setMyInt(100); object.setArrList(airrList); Intent intent = new Intent(MainActivity.this,ReceiviewPaircel.class); intent.putExtra("paircel", object); stairtActivity(intent); } 

ReceiviewPaircel.java

 @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle b = getIntent().getExtras(); MyPaircelable object = b.getPaircelable("paircel"); System.out.println(object.getArrList().get(0).getTest()); System.out.println(object.getMyInt()); } 
Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.