how to pass Array list to another activity










1















I pass Array list to intent but give an error . so please tell me what is wrong.
This is my code



For Sending



addToCartList=new ArrayList<>();
Intent intent=new Intent(ShopingCart.this,SelectedProductFromShopingCartShow.class);
intent.putExtra("selectedList", (Serializable) addToCartList);
startActivity(intent);


And its my Receiver code



public class SelectedProductFromShopingCartShow extends AppCompatActivity

ArrayList<ShowProducts> arrayList=new ArrayList<>();
String condition="SelectedItemsFromShoppingCart";

@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_selected_product_from_shoping_cart_show);

arrayList= (ArrayList<ShowProducts>) getIntent().getSerializableExtra("selectedList");





Here's my error



07-25 20:15:54.280 16503-16503/com.sizdom.sizdomstockmanager E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.RuntimeException: Parcel: unable to marshal value ShowProductsproduct_name='Almost new', product_photo='http://192.168.1.39:81/sizdom/sizdomstock/product_images/1-Almost-new-17-07-11-10-27-21.jpg', product_sizes=0, product_created_date='null'
at android.os.Parcel.writeValue(Parcel.java:1235)
at android.os.Parcel.writeList(Parcel.java:622)
at android.os.Parcel.writeValue(Parcel.java:1195)
at android.os.Parcel.writeMapInternal(Parcel.java:591)
at android.os.Bundle.writeToParcel(Bundle.java:1627)
at android.os.Parcel.writeBundle(Parcel.java:605)
at android.content.Intent.writeToParcel(Intent.java:6660)
at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:1865)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1424)
at android.app.Activity.startActivityForResult(Activity.java:3370)
at android.support.v4.app.BaseFragmentActivityJB.startActivityForResult(BaseFragmentActivityJB.java:50)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:79)
at android.app.Activity.startActivityForResult(Activity.java:3331)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:859)
at android.app.Activity.startActivity(Activity.java:3566)
at android.app.Activity.startActivity(Activity.java:3534)
at com.sizdom.sizdomstockmanager.ShopingCart$1.onClick(ShopingCart.java:66)
at android.view.View.performClick(View.java:4204)
at android.view.View$PerformClick.run(View.java:17355)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5069)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
07-25 20:20:54.325 700-910/system_process E/InputDispatcher: channel '536cf278 com.sizdom.sizdomstockmanager/com.sizdom.sizdomstockmanager.SplashScrean (server)' ~ Channel is unrecoverably broken and will be disposed!
07-25 20:20:54.325 700-910/system_process E/InputDispatcher: channel '535f9848 com.sizdom.sizdomstockmanager/com.sizdom.sizdomstockmanager.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
07-25 20:20:54.381 21855-21855/? E/Trace: error opening trace file: No such file or directory (2)
07-25 20:20:54.557 21855-21855/? E/dalvikvm: Could not find class 'android.graphics.drawable.RippleDrawable', referenced from method android.support.v7.widget.AppCompatImageHelper.hasOverlappingRendering


ShowProducts class



public class ShowProducts 
String product_name;
String product_photo;
int product_sizes;
String product_created_date;
int size_id;
String size_name;
int size_price;
int size_cost;
int size_quantity;
int product_id;

public int getProduct_id()
return product_id;


public void setProduct_id(int product_id)
this.product_id = product_id;


public String getProduct_name()
return product_name;


public void setProduct_name(String product_name)
this.product_name = product_name;


public String getProduct_photo()
return product_photo;


public void setProduct_photo(String product_photo)
this.product_photo = product_photo;


public int getProduct_sizes()
return product_sizes;


public void setProduct_sizes(int product_sizes)
this.product_sizes = product_sizes;


public String getProduct_created_date()
return product_created_date;


public void setProduct_created_date(String product_created_date)
this.product_created_date = product_created_date;


public int getSize_id()
return size_id;


public void setSize_id(int size_id)
this.size_id = size_id;


public String getSize_name()
return size_name;


public void setSize_name(String size_name)
this.size_name = size_name;


public int getSize_price()
return size_price;


public void setSize_price(int size_price)
this.size_price = size_price;


public int getSize_cost()
return size_cost;


public void setSize_cost(int size_cost)
this.size_cost = size_cost;


public int getSize_quantity()
return size_quantity;


public void setSize_quantity(int size_quantity)
this.size_quantity = size_quantity;












share|improve this question
























  • try this example stackoverflow.com/a/44956149/1548824

    – akhilesh0707
    Jul 25 '17 at 12:33











  • post your ShowProducts class

    – akhilesh0707
    Jul 25 '17 at 12:34















1















I pass Array list to intent but give an error . so please tell me what is wrong.
This is my code



For Sending



addToCartList=new ArrayList<>();
Intent intent=new Intent(ShopingCart.this,SelectedProductFromShopingCartShow.class);
intent.putExtra("selectedList", (Serializable) addToCartList);
startActivity(intent);


And its my Receiver code



public class SelectedProductFromShopingCartShow extends AppCompatActivity

ArrayList<ShowProducts> arrayList=new ArrayList<>();
String condition="SelectedItemsFromShoppingCart";

@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_selected_product_from_shoping_cart_show);

arrayList= (ArrayList<ShowProducts>) getIntent().getSerializableExtra("selectedList");





Here's my error



07-25 20:15:54.280 16503-16503/com.sizdom.sizdomstockmanager E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.RuntimeException: Parcel: unable to marshal value ShowProductsproduct_name='Almost new', product_photo='http://192.168.1.39:81/sizdom/sizdomstock/product_images/1-Almost-new-17-07-11-10-27-21.jpg', product_sizes=0, product_created_date='null'
at android.os.Parcel.writeValue(Parcel.java:1235)
at android.os.Parcel.writeList(Parcel.java:622)
at android.os.Parcel.writeValue(Parcel.java:1195)
at android.os.Parcel.writeMapInternal(Parcel.java:591)
at android.os.Bundle.writeToParcel(Bundle.java:1627)
at android.os.Parcel.writeBundle(Parcel.java:605)
at android.content.Intent.writeToParcel(Intent.java:6660)
at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:1865)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1424)
at android.app.Activity.startActivityForResult(Activity.java:3370)
at android.support.v4.app.BaseFragmentActivityJB.startActivityForResult(BaseFragmentActivityJB.java:50)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:79)
at android.app.Activity.startActivityForResult(Activity.java:3331)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:859)
at android.app.Activity.startActivity(Activity.java:3566)
at android.app.Activity.startActivity(Activity.java:3534)
at com.sizdom.sizdomstockmanager.ShopingCart$1.onClick(ShopingCart.java:66)
at android.view.View.performClick(View.java:4204)
at android.view.View$PerformClick.run(View.java:17355)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5069)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
07-25 20:20:54.325 700-910/system_process E/InputDispatcher: channel '536cf278 com.sizdom.sizdomstockmanager/com.sizdom.sizdomstockmanager.SplashScrean (server)' ~ Channel is unrecoverably broken and will be disposed!
07-25 20:20:54.325 700-910/system_process E/InputDispatcher: channel '535f9848 com.sizdom.sizdomstockmanager/com.sizdom.sizdomstockmanager.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
07-25 20:20:54.381 21855-21855/? E/Trace: error opening trace file: No such file or directory (2)
07-25 20:20:54.557 21855-21855/? E/dalvikvm: Could not find class 'android.graphics.drawable.RippleDrawable', referenced from method android.support.v7.widget.AppCompatImageHelper.hasOverlappingRendering


ShowProducts class



public class ShowProducts 
String product_name;
String product_photo;
int product_sizes;
String product_created_date;
int size_id;
String size_name;
int size_price;
int size_cost;
int size_quantity;
int product_id;

public int getProduct_id()
return product_id;


public void setProduct_id(int product_id)
this.product_id = product_id;


public String getProduct_name()
return product_name;


public void setProduct_name(String product_name)
this.product_name = product_name;


public String getProduct_photo()
return product_photo;


public void setProduct_photo(String product_photo)
this.product_photo = product_photo;


public int getProduct_sizes()
return product_sizes;


public void setProduct_sizes(int product_sizes)
this.product_sizes = product_sizes;


public String getProduct_created_date()
return product_created_date;


public void setProduct_created_date(String product_created_date)
this.product_created_date = product_created_date;


public int getSize_id()
return size_id;


public void setSize_id(int size_id)
this.size_id = size_id;


public String getSize_name()
return size_name;


public void setSize_name(String size_name)
this.size_name = size_name;


public int getSize_price()
return size_price;


public void setSize_price(int size_price)
this.size_price = size_price;


public int getSize_cost()
return size_cost;


public void setSize_cost(int size_cost)
this.size_cost = size_cost;


public int getSize_quantity()
return size_quantity;


public void setSize_quantity(int size_quantity)
this.size_quantity = size_quantity;












share|improve this question
























  • try this example stackoverflow.com/a/44956149/1548824

    – akhilesh0707
    Jul 25 '17 at 12:33











  • post your ShowProducts class

    – akhilesh0707
    Jul 25 '17 at 12:34













1












1








1








I pass Array list to intent but give an error . so please tell me what is wrong.
This is my code



For Sending



addToCartList=new ArrayList<>();
Intent intent=new Intent(ShopingCart.this,SelectedProductFromShopingCartShow.class);
intent.putExtra("selectedList", (Serializable) addToCartList);
startActivity(intent);


And its my Receiver code



public class SelectedProductFromShopingCartShow extends AppCompatActivity

ArrayList<ShowProducts> arrayList=new ArrayList<>();
String condition="SelectedItemsFromShoppingCart";

@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_selected_product_from_shoping_cart_show);

arrayList= (ArrayList<ShowProducts>) getIntent().getSerializableExtra("selectedList");





Here's my error



07-25 20:15:54.280 16503-16503/com.sizdom.sizdomstockmanager E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.RuntimeException: Parcel: unable to marshal value ShowProductsproduct_name='Almost new', product_photo='http://192.168.1.39:81/sizdom/sizdomstock/product_images/1-Almost-new-17-07-11-10-27-21.jpg', product_sizes=0, product_created_date='null'
at android.os.Parcel.writeValue(Parcel.java:1235)
at android.os.Parcel.writeList(Parcel.java:622)
at android.os.Parcel.writeValue(Parcel.java:1195)
at android.os.Parcel.writeMapInternal(Parcel.java:591)
at android.os.Bundle.writeToParcel(Bundle.java:1627)
at android.os.Parcel.writeBundle(Parcel.java:605)
at android.content.Intent.writeToParcel(Intent.java:6660)
at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:1865)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1424)
at android.app.Activity.startActivityForResult(Activity.java:3370)
at android.support.v4.app.BaseFragmentActivityJB.startActivityForResult(BaseFragmentActivityJB.java:50)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:79)
at android.app.Activity.startActivityForResult(Activity.java:3331)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:859)
at android.app.Activity.startActivity(Activity.java:3566)
at android.app.Activity.startActivity(Activity.java:3534)
at com.sizdom.sizdomstockmanager.ShopingCart$1.onClick(ShopingCart.java:66)
at android.view.View.performClick(View.java:4204)
at android.view.View$PerformClick.run(View.java:17355)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5069)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
07-25 20:20:54.325 700-910/system_process E/InputDispatcher: channel '536cf278 com.sizdom.sizdomstockmanager/com.sizdom.sizdomstockmanager.SplashScrean (server)' ~ Channel is unrecoverably broken and will be disposed!
07-25 20:20:54.325 700-910/system_process E/InputDispatcher: channel '535f9848 com.sizdom.sizdomstockmanager/com.sizdom.sizdomstockmanager.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
07-25 20:20:54.381 21855-21855/? E/Trace: error opening trace file: No such file or directory (2)
07-25 20:20:54.557 21855-21855/? E/dalvikvm: Could not find class 'android.graphics.drawable.RippleDrawable', referenced from method android.support.v7.widget.AppCompatImageHelper.hasOverlappingRendering


ShowProducts class



public class ShowProducts 
String product_name;
String product_photo;
int product_sizes;
String product_created_date;
int size_id;
String size_name;
int size_price;
int size_cost;
int size_quantity;
int product_id;

public int getProduct_id()
return product_id;


public void setProduct_id(int product_id)
this.product_id = product_id;


public String getProduct_name()
return product_name;


public void setProduct_name(String product_name)
this.product_name = product_name;


public String getProduct_photo()
return product_photo;


public void setProduct_photo(String product_photo)
this.product_photo = product_photo;


public int getProduct_sizes()
return product_sizes;


public void setProduct_sizes(int product_sizes)
this.product_sizes = product_sizes;


public String getProduct_created_date()
return product_created_date;


public void setProduct_created_date(String product_created_date)
this.product_created_date = product_created_date;


public int getSize_id()
return size_id;


public void setSize_id(int size_id)
this.size_id = size_id;


public String getSize_name()
return size_name;


public void setSize_name(String size_name)
this.size_name = size_name;


public int getSize_price()
return size_price;


public void setSize_price(int size_price)
this.size_price = size_price;


public int getSize_cost()
return size_cost;


public void setSize_cost(int size_cost)
this.size_cost = size_cost;


public int getSize_quantity()
return size_quantity;


public void setSize_quantity(int size_quantity)
this.size_quantity = size_quantity;












share|improve this question
















I pass Array list to intent but give an error . so please tell me what is wrong.
This is my code



For Sending



addToCartList=new ArrayList<>();
Intent intent=new Intent(ShopingCart.this,SelectedProductFromShopingCartShow.class);
intent.putExtra("selectedList", (Serializable) addToCartList);
startActivity(intent);


And its my Receiver code



public class SelectedProductFromShopingCartShow extends AppCompatActivity

ArrayList<ShowProducts> arrayList=new ArrayList<>();
String condition="SelectedItemsFromShoppingCart";

@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_selected_product_from_shoping_cart_show);

arrayList= (ArrayList<ShowProducts>) getIntent().getSerializableExtra("selectedList");





Here's my error



07-25 20:15:54.280 16503-16503/com.sizdom.sizdomstockmanager E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.RuntimeException: Parcel: unable to marshal value ShowProductsproduct_name='Almost new', product_photo='http://192.168.1.39:81/sizdom/sizdomstock/product_images/1-Almost-new-17-07-11-10-27-21.jpg', product_sizes=0, product_created_date='null'
at android.os.Parcel.writeValue(Parcel.java:1235)
at android.os.Parcel.writeList(Parcel.java:622)
at android.os.Parcel.writeValue(Parcel.java:1195)
at android.os.Parcel.writeMapInternal(Parcel.java:591)
at android.os.Bundle.writeToParcel(Bundle.java:1627)
at android.os.Parcel.writeBundle(Parcel.java:605)
at android.content.Intent.writeToParcel(Intent.java:6660)
at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:1865)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1424)
at android.app.Activity.startActivityForResult(Activity.java:3370)
at android.support.v4.app.BaseFragmentActivityJB.startActivityForResult(BaseFragmentActivityJB.java:50)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:79)
at android.app.Activity.startActivityForResult(Activity.java:3331)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:859)
at android.app.Activity.startActivity(Activity.java:3566)
at android.app.Activity.startActivity(Activity.java:3534)
at com.sizdom.sizdomstockmanager.ShopingCart$1.onClick(ShopingCart.java:66)
at android.view.View.performClick(View.java:4204)
at android.view.View$PerformClick.run(View.java:17355)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5069)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
07-25 20:20:54.325 700-910/system_process E/InputDispatcher: channel '536cf278 com.sizdom.sizdomstockmanager/com.sizdom.sizdomstockmanager.SplashScrean (server)' ~ Channel is unrecoverably broken and will be disposed!
07-25 20:20:54.325 700-910/system_process E/InputDispatcher: channel '535f9848 com.sizdom.sizdomstockmanager/com.sizdom.sizdomstockmanager.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
07-25 20:20:54.381 21855-21855/? E/Trace: error opening trace file: No such file or directory (2)
07-25 20:20:54.557 21855-21855/? E/dalvikvm: Could not find class 'android.graphics.drawable.RippleDrawable', referenced from method android.support.v7.widget.AppCompatImageHelper.hasOverlappingRendering


ShowProducts class



public class ShowProducts 
String product_name;
String product_photo;
int product_sizes;
String product_created_date;
int size_id;
String size_name;
int size_price;
int size_cost;
int size_quantity;
int product_id;

public int getProduct_id()
return product_id;


public void setProduct_id(int product_id)
this.product_id = product_id;


public String getProduct_name()
return product_name;


public void setProduct_name(String product_name)
this.product_name = product_name;


public String getProduct_photo()
return product_photo;


public void setProduct_photo(String product_photo)
this.product_photo = product_photo;


public int getProduct_sizes()
return product_sizes;


public void setProduct_sizes(int product_sizes)
this.product_sizes = product_sizes;


public String getProduct_created_date()
return product_created_date;


public void setProduct_created_date(String product_created_date)
this.product_created_date = product_created_date;


public int getSize_id()
return size_id;


public void setSize_id(int size_id)
this.size_id = size_id;


public String getSize_name()
return size_name;


public void setSize_name(String size_name)
this.size_name = size_name;


public int getSize_price()
return size_price;


public void setSize_price(int size_price)
this.size_price = size_price;


public int getSize_cost()
return size_cost;


public void setSize_cost(int size_cost)
this.size_cost = size_cost;


public int getSize_quantity()
return size_quantity;


public void setSize_quantity(int size_quantity)
this.size_quantity = size_quantity;









android object android-intent arraylist parameter-passing






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jul 25 '17 at 13:51









Doomsknight

10.5k1563134




10.5k1563134










asked Jul 25 '17 at 12:30









Rana UmerfarooqRana Umerfarooq

317




317












  • try this example stackoverflow.com/a/44956149/1548824

    – akhilesh0707
    Jul 25 '17 at 12:33











  • post your ShowProducts class

    – akhilesh0707
    Jul 25 '17 at 12:34

















  • try this example stackoverflow.com/a/44956149/1548824

    – akhilesh0707
    Jul 25 '17 at 12:33











  • post your ShowProducts class

    – akhilesh0707
    Jul 25 '17 at 12:34
















try this example stackoverflow.com/a/44956149/1548824

– akhilesh0707
Jul 25 '17 at 12:33





try this example stackoverflow.com/a/44956149/1548824

– akhilesh0707
Jul 25 '17 at 12:33













post your ShowProducts class

– akhilesh0707
Jul 25 '17 at 12:34





post your ShowProducts class

– akhilesh0707
Jul 25 '17 at 12:34












6 Answers
6






active

oldest

votes


















2














Please write ShowProducts implements Serializable in your model class.

This will resolve the issue.






share|improve this answer
































    1














    There is no built in method to pass array list of objects from one activity to another activity via intents. You need to implement Parcelable interface.
    Checkout developer console for the documentation.



    https://developer.android.com/reference/android/os/Parcelable.html






    share|improve this answer






























      1














      First of all, serializing the items and passing it as the serializable list in Android is not recomended.



      Android provides a secure and fast way to do this. We can use "Parcelable" interface. Use something like the below "Parcelable pojo" to move your list items from one activity to another.



      public class ShowProducts implements Parcelable 

      // THis class implents pracellable but does not create a CREATOR field
      String product_name;
      String product_photo;
      int product_sizes;
      String product_created_date;
      int size_id;
      String size_name;
      int size_price;
      int size_cost;
      int size_quantity;
      int product_id;

      protected ShowProducts(Parcel in)
      product_name = in.readString();
      product_photo = in.readString();
      product_sizes = in.readInt();
      product_created_date = in.readString();
      size_id = in.readInt();
      size_name = in.readString();
      size_price = in.readInt();
      size_cost = in.readInt();
      size_quantity = in.readInt();
      product_id = in.readInt();


      public static final Creator<ShowProducts> CREATOR = new Creator<ShowProducts>()
      @Override
      public ShowProducts createFromParcel(Parcel in)
      return new ShowProducts(in);


      @Override
      public ShowProducts newArray(int size)
      return new ShowProducts[size];

      ;

      public int getProduct_id()
      return product_id;


      public void setProduct_id(int product_id)
      this.product_id = product_id;


      public String getProduct_name()
      return product_name;


      public void setProduct_name(String product_name)
      this.product_name = product_name;


      public String getProduct_photo()
      return product_photo;


      public void setProduct_photo(String product_photo)
      this.product_photo = product_photo;


      public int getProduct_sizes()
      return product_sizes;


      public void setProduct_sizes(int product_sizes)
      this.product_sizes = product_sizes;


      public String getProduct_created_date()
      return product_created_date;


      public void setProduct_created_date(String product_created_date)
      this.product_created_date = product_created_date;


      public int getSize_id()
      return size_id;


      public void setSize_id(int size_id)
      this.size_id = size_id;


      public String getSize_name()
      return size_name;


      public void setSize_name(String size_name)
      this.size_name = size_name;


      public int getSize_price()
      return size_price;


      public void setSize_price(int size_price)
      this.size_price = size_price;


      public int getSize_cost()
      return size_cost;


      public void setSize_cost(int size_cost)
      this.size_cost = size_cost;


      public int getSize_quantity()
      return size_quantity;


      public void setSize_quantity(int size_quantity)
      this.size_quantity = size_quantity;


      @Override
      public int describeContents()
      return 0;


      @Override
      public void writeToParcel(Parcel parcel, int i)
      parcel.writeString(product_name);
      parcel.writeString(product_photo);
      parcel.writeInt(product_sizes);
      parcel.writeString(product_created_date);
      parcel.writeInt(size_id);
      parcel.writeString(size_name);
      parcel.writeInt(size_price);
      parcel.writeInt(size_cost);
      parcel.writeInt(size_quantity);
      parcel.writeInt(product_id);





      You can use below code to move your array list to another activity.



      addToCartList=new ArrayList<>();
      Intent intent=new Intent(ShopingCart.this,SelectedProductFromShopingCartShow.class);
      intent.putParcelableArrayListExtra("selectedList",addToArrayList);
      startActivity(intent);


      Use below code to receive it in another activity.



      getIntent().getParcelableArrayListExtra("selectedList");



      For Android Studio the shortcut for implementing Parcelable interface is ALT+ENTER.
      Just implement the Parcelable interface with implementing the Java class.
      Android studio will intimate you with red error to implement and create the CREATOR. Android Studio will generate the beautiful code for you.
      That's it. Enjoy.







      share|improve this answer






























        0














        Your ShowProducts object must implements Parcelable.
        You can easily make your Object parcelable with an online tool like : http://www.parcelabler.com/



        This post can help you : How can I make my custom objects Parcelable?






        share|improve this answer






























          0














          Please try this ...



          addToCartList=new ArrayList<>();
          Intent intent=new
          Intent(ShopingCart.this,SelectedProductFromShopingCartShow.class);
          intent.putStringArrayListExtra("selectedList", addToCartList);
          startActivity(intent);


          In Your receiving Activity...



          public class SelectedProductFromShopingCartShow extends AppCompatActivity
          ArrayList<ShowProducts> arrayList=new ArrayList<>();
          String condition="SelectedItemsFromShoppingCart";

          @Override
          protected void onCreate(Bundle savedInstanceState)
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_selected_product_from_shoping_cart_show);
          arrayList= (ArrayList<ShowProducts>)
          getIntent().getStringArrayListExtra("selectedList");






          share|improve this answer
































            0














            The following code works for me:



             Intent intent = new Intent(this, editList.class);
            intent.putStringArrayListExtra("list", list);
            startActivity(intent);


            You can get the result using:



            ArrayList<String>() array_list = new ArrayList<String>();

            array_list = getIntent().getStringArrayListExtra("list");





            share|improve this answer

























              Your Answer






              StackExchange.ifUsing("editor", function ()
              StackExchange.using("externalEditor", function ()
              StackExchange.using("snippets", function ()
              StackExchange.snippets.init();
              );
              );
              , "code-snippets");

              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "1"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f45303371%2fhow-to-pass-array-list-object-to-another-activity%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              6 Answers
              6






              active

              oldest

              votes








              6 Answers
              6






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              2














              Please write ShowProducts implements Serializable in your model class.

              This will resolve the issue.






              share|improve this answer





























                2














                Please write ShowProducts implements Serializable in your model class.

                This will resolve the issue.






                share|improve this answer



























                  2












                  2








                  2







                  Please write ShowProducts implements Serializable in your model class.

                  This will resolve the issue.






                  share|improve this answer















                  Please write ShowProducts implements Serializable in your model class.

                  This will resolve the issue.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Aug 6 '17 at 21:12









                  Cody Gray

                  195k35383474




                  195k35383474










                  answered Jul 25 '17 at 12:33









                  Prateek BhardwajPrateek Bhardwaj

                  1,90121528




                  1,90121528























                      1














                      There is no built in method to pass array list of objects from one activity to another activity via intents. You need to implement Parcelable interface.
                      Checkout developer console for the documentation.



                      https://developer.android.com/reference/android/os/Parcelable.html






                      share|improve this answer



























                        1














                        There is no built in method to pass array list of objects from one activity to another activity via intents. You need to implement Parcelable interface.
                        Checkout developer console for the documentation.



                        https://developer.android.com/reference/android/os/Parcelable.html






                        share|improve this answer

























                          1












                          1








                          1







                          There is no built in method to pass array list of objects from one activity to another activity via intents. You need to implement Parcelable interface.
                          Checkout developer console for the documentation.



                          https://developer.android.com/reference/android/os/Parcelable.html






                          share|improve this answer













                          There is no built in method to pass array list of objects from one activity to another activity via intents. You need to implement Parcelable interface.
                          Checkout developer console for the documentation.



                          https://developer.android.com/reference/android/os/Parcelable.html







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Jul 25 '17 at 12:37









                          Prasad PHPrasad PH

                          907




                          907





















                              1














                              First of all, serializing the items and passing it as the serializable list in Android is not recomended.



                              Android provides a secure and fast way to do this. We can use "Parcelable" interface. Use something like the below "Parcelable pojo" to move your list items from one activity to another.



                              public class ShowProducts implements Parcelable 

                              // THis class implents pracellable but does not create a CREATOR field
                              String product_name;
                              String product_photo;
                              int product_sizes;
                              String product_created_date;
                              int size_id;
                              String size_name;
                              int size_price;
                              int size_cost;
                              int size_quantity;
                              int product_id;

                              protected ShowProducts(Parcel in)
                              product_name = in.readString();
                              product_photo = in.readString();
                              product_sizes = in.readInt();
                              product_created_date = in.readString();
                              size_id = in.readInt();
                              size_name = in.readString();
                              size_price = in.readInt();
                              size_cost = in.readInt();
                              size_quantity = in.readInt();
                              product_id = in.readInt();


                              public static final Creator<ShowProducts> CREATOR = new Creator<ShowProducts>()
                              @Override
                              public ShowProducts createFromParcel(Parcel in)
                              return new ShowProducts(in);


                              @Override
                              public ShowProducts newArray(int size)
                              return new ShowProducts[size];

                              ;

                              public int getProduct_id()
                              return product_id;


                              public void setProduct_id(int product_id)
                              this.product_id = product_id;


                              public String getProduct_name()
                              return product_name;


                              public void setProduct_name(String product_name)
                              this.product_name = product_name;


                              public String getProduct_photo()
                              return product_photo;


                              public void setProduct_photo(String product_photo)
                              this.product_photo = product_photo;


                              public int getProduct_sizes()
                              return product_sizes;


                              public void setProduct_sizes(int product_sizes)
                              this.product_sizes = product_sizes;


                              public String getProduct_created_date()
                              return product_created_date;


                              public void setProduct_created_date(String product_created_date)
                              this.product_created_date = product_created_date;


                              public int getSize_id()
                              return size_id;


                              public void setSize_id(int size_id)
                              this.size_id = size_id;


                              public String getSize_name()
                              return size_name;


                              public void setSize_name(String size_name)
                              this.size_name = size_name;


                              public int getSize_price()
                              return size_price;


                              public void setSize_price(int size_price)
                              this.size_price = size_price;


                              public int getSize_cost()
                              return size_cost;


                              public void setSize_cost(int size_cost)
                              this.size_cost = size_cost;


                              public int getSize_quantity()
                              return size_quantity;


                              public void setSize_quantity(int size_quantity)
                              this.size_quantity = size_quantity;


                              @Override
                              public int describeContents()
                              return 0;


                              @Override
                              public void writeToParcel(Parcel parcel, int i)
                              parcel.writeString(product_name);
                              parcel.writeString(product_photo);
                              parcel.writeInt(product_sizes);
                              parcel.writeString(product_created_date);
                              parcel.writeInt(size_id);
                              parcel.writeString(size_name);
                              parcel.writeInt(size_price);
                              parcel.writeInt(size_cost);
                              parcel.writeInt(size_quantity);
                              parcel.writeInt(product_id);





                              You can use below code to move your array list to another activity.



                              addToCartList=new ArrayList<>();
                              Intent intent=new Intent(ShopingCart.this,SelectedProductFromShopingCartShow.class);
                              intent.putParcelableArrayListExtra("selectedList",addToArrayList);
                              startActivity(intent);


                              Use below code to receive it in another activity.



                              getIntent().getParcelableArrayListExtra("selectedList");



                              For Android Studio the shortcut for implementing Parcelable interface is ALT+ENTER.
                              Just implement the Parcelable interface with implementing the Java class.
                              Android studio will intimate you with red error to implement and create the CREATOR. Android Studio will generate the beautiful code for you.
                              That's it. Enjoy.







                              share|improve this answer



























                                1














                                First of all, serializing the items and passing it as the serializable list in Android is not recomended.



                                Android provides a secure and fast way to do this. We can use "Parcelable" interface. Use something like the below "Parcelable pojo" to move your list items from one activity to another.



                                public class ShowProducts implements Parcelable 

                                // THis class implents pracellable but does not create a CREATOR field
                                String product_name;
                                String product_photo;
                                int product_sizes;
                                String product_created_date;
                                int size_id;
                                String size_name;
                                int size_price;
                                int size_cost;
                                int size_quantity;
                                int product_id;

                                protected ShowProducts(Parcel in)
                                product_name = in.readString();
                                product_photo = in.readString();
                                product_sizes = in.readInt();
                                product_created_date = in.readString();
                                size_id = in.readInt();
                                size_name = in.readString();
                                size_price = in.readInt();
                                size_cost = in.readInt();
                                size_quantity = in.readInt();
                                product_id = in.readInt();


                                public static final Creator<ShowProducts> CREATOR = new Creator<ShowProducts>()
                                @Override
                                public ShowProducts createFromParcel(Parcel in)
                                return new ShowProducts(in);


                                @Override
                                public ShowProducts newArray(int size)
                                return new ShowProducts[size];

                                ;

                                public int getProduct_id()
                                return product_id;


                                public void setProduct_id(int product_id)
                                this.product_id = product_id;


                                public String getProduct_name()
                                return product_name;


                                public void setProduct_name(String product_name)
                                this.product_name = product_name;


                                public String getProduct_photo()
                                return product_photo;


                                public void setProduct_photo(String product_photo)
                                this.product_photo = product_photo;


                                public int getProduct_sizes()
                                return product_sizes;


                                public void setProduct_sizes(int product_sizes)
                                this.product_sizes = product_sizes;


                                public String getProduct_created_date()
                                return product_created_date;


                                public void setProduct_created_date(String product_created_date)
                                this.product_created_date = product_created_date;


                                public int getSize_id()
                                return size_id;


                                public void setSize_id(int size_id)
                                this.size_id = size_id;


                                public String getSize_name()
                                return size_name;


                                public void setSize_name(String size_name)
                                this.size_name = size_name;


                                public int getSize_price()
                                return size_price;


                                public void setSize_price(int size_price)
                                this.size_price = size_price;


                                public int getSize_cost()
                                return size_cost;


                                public void setSize_cost(int size_cost)
                                this.size_cost = size_cost;


                                public int getSize_quantity()
                                return size_quantity;


                                public void setSize_quantity(int size_quantity)
                                this.size_quantity = size_quantity;


                                @Override
                                public int describeContents()
                                return 0;


                                @Override
                                public void writeToParcel(Parcel parcel, int i)
                                parcel.writeString(product_name);
                                parcel.writeString(product_photo);
                                parcel.writeInt(product_sizes);
                                parcel.writeString(product_created_date);
                                parcel.writeInt(size_id);
                                parcel.writeString(size_name);
                                parcel.writeInt(size_price);
                                parcel.writeInt(size_cost);
                                parcel.writeInt(size_quantity);
                                parcel.writeInt(product_id);





                                You can use below code to move your array list to another activity.



                                addToCartList=new ArrayList<>();
                                Intent intent=new Intent(ShopingCart.this,SelectedProductFromShopingCartShow.class);
                                intent.putParcelableArrayListExtra("selectedList",addToArrayList);
                                startActivity(intent);


                                Use below code to receive it in another activity.



                                getIntent().getParcelableArrayListExtra("selectedList");



                                For Android Studio the shortcut for implementing Parcelable interface is ALT+ENTER.
                                Just implement the Parcelable interface with implementing the Java class.
                                Android studio will intimate you with red error to implement and create the CREATOR. Android Studio will generate the beautiful code for you.
                                That's it. Enjoy.







                                share|improve this answer

























                                  1












                                  1








                                  1







                                  First of all, serializing the items and passing it as the serializable list in Android is not recomended.



                                  Android provides a secure and fast way to do this. We can use "Parcelable" interface. Use something like the below "Parcelable pojo" to move your list items from one activity to another.



                                  public class ShowProducts implements Parcelable 

                                  // THis class implents pracellable but does not create a CREATOR field
                                  String product_name;
                                  String product_photo;
                                  int product_sizes;
                                  String product_created_date;
                                  int size_id;
                                  String size_name;
                                  int size_price;
                                  int size_cost;
                                  int size_quantity;
                                  int product_id;

                                  protected ShowProducts(Parcel in)
                                  product_name = in.readString();
                                  product_photo = in.readString();
                                  product_sizes = in.readInt();
                                  product_created_date = in.readString();
                                  size_id = in.readInt();
                                  size_name = in.readString();
                                  size_price = in.readInt();
                                  size_cost = in.readInt();
                                  size_quantity = in.readInt();
                                  product_id = in.readInt();


                                  public static final Creator<ShowProducts> CREATOR = new Creator<ShowProducts>()
                                  @Override
                                  public ShowProducts createFromParcel(Parcel in)
                                  return new ShowProducts(in);


                                  @Override
                                  public ShowProducts newArray(int size)
                                  return new ShowProducts[size];

                                  ;

                                  public int getProduct_id()
                                  return product_id;


                                  public void setProduct_id(int product_id)
                                  this.product_id = product_id;


                                  public String getProduct_name()
                                  return product_name;


                                  public void setProduct_name(String product_name)
                                  this.product_name = product_name;


                                  public String getProduct_photo()
                                  return product_photo;


                                  public void setProduct_photo(String product_photo)
                                  this.product_photo = product_photo;


                                  public int getProduct_sizes()
                                  return product_sizes;


                                  public void setProduct_sizes(int product_sizes)
                                  this.product_sizes = product_sizes;


                                  public String getProduct_created_date()
                                  return product_created_date;


                                  public void setProduct_created_date(String product_created_date)
                                  this.product_created_date = product_created_date;


                                  public int getSize_id()
                                  return size_id;


                                  public void setSize_id(int size_id)
                                  this.size_id = size_id;


                                  public String getSize_name()
                                  return size_name;


                                  public void setSize_name(String size_name)
                                  this.size_name = size_name;


                                  public int getSize_price()
                                  return size_price;


                                  public void setSize_price(int size_price)
                                  this.size_price = size_price;


                                  public int getSize_cost()
                                  return size_cost;


                                  public void setSize_cost(int size_cost)
                                  this.size_cost = size_cost;


                                  public int getSize_quantity()
                                  return size_quantity;


                                  public void setSize_quantity(int size_quantity)
                                  this.size_quantity = size_quantity;


                                  @Override
                                  public int describeContents()
                                  return 0;


                                  @Override
                                  public void writeToParcel(Parcel parcel, int i)
                                  parcel.writeString(product_name);
                                  parcel.writeString(product_photo);
                                  parcel.writeInt(product_sizes);
                                  parcel.writeString(product_created_date);
                                  parcel.writeInt(size_id);
                                  parcel.writeString(size_name);
                                  parcel.writeInt(size_price);
                                  parcel.writeInt(size_cost);
                                  parcel.writeInt(size_quantity);
                                  parcel.writeInt(product_id);





                                  You can use below code to move your array list to another activity.



                                  addToCartList=new ArrayList<>();
                                  Intent intent=new Intent(ShopingCart.this,SelectedProductFromShopingCartShow.class);
                                  intent.putParcelableArrayListExtra("selectedList",addToArrayList);
                                  startActivity(intent);


                                  Use below code to receive it in another activity.



                                  getIntent().getParcelableArrayListExtra("selectedList");



                                  For Android Studio the shortcut for implementing Parcelable interface is ALT+ENTER.
                                  Just implement the Parcelable interface with implementing the Java class.
                                  Android studio will intimate you with red error to implement and create the CREATOR. Android Studio will generate the beautiful code for you.
                                  That's it. Enjoy.







                                  share|improve this answer













                                  First of all, serializing the items and passing it as the serializable list in Android is not recomended.



                                  Android provides a secure and fast way to do this. We can use "Parcelable" interface. Use something like the below "Parcelable pojo" to move your list items from one activity to another.



                                  public class ShowProducts implements Parcelable 

                                  // THis class implents pracellable but does not create a CREATOR field
                                  String product_name;
                                  String product_photo;
                                  int product_sizes;
                                  String product_created_date;
                                  int size_id;
                                  String size_name;
                                  int size_price;
                                  int size_cost;
                                  int size_quantity;
                                  int product_id;

                                  protected ShowProducts(Parcel in)
                                  product_name = in.readString();
                                  product_photo = in.readString();
                                  product_sizes = in.readInt();
                                  product_created_date = in.readString();
                                  size_id = in.readInt();
                                  size_name = in.readString();
                                  size_price = in.readInt();
                                  size_cost = in.readInt();
                                  size_quantity = in.readInt();
                                  product_id = in.readInt();


                                  public static final Creator<ShowProducts> CREATOR = new Creator<ShowProducts>()
                                  @Override
                                  public ShowProducts createFromParcel(Parcel in)
                                  return new ShowProducts(in);


                                  @Override
                                  public ShowProducts newArray(int size)
                                  return new ShowProducts[size];

                                  ;

                                  public int getProduct_id()
                                  return product_id;


                                  public void setProduct_id(int product_id)
                                  this.product_id = product_id;


                                  public String getProduct_name()
                                  return product_name;


                                  public void setProduct_name(String product_name)
                                  this.product_name = product_name;


                                  public String getProduct_photo()
                                  return product_photo;


                                  public void setProduct_photo(String product_photo)
                                  this.product_photo = product_photo;


                                  public int getProduct_sizes()
                                  return product_sizes;


                                  public void setProduct_sizes(int product_sizes)
                                  this.product_sizes = product_sizes;


                                  public String getProduct_created_date()
                                  return product_created_date;


                                  public void setProduct_created_date(String product_created_date)
                                  this.product_created_date = product_created_date;


                                  public int getSize_id()
                                  return size_id;


                                  public void setSize_id(int size_id)
                                  this.size_id = size_id;


                                  public String getSize_name()
                                  return size_name;


                                  public void setSize_name(String size_name)
                                  this.size_name = size_name;


                                  public int getSize_price()
                                  return size_price;


                                  public void setSize_price(int size_price)
                                  this.size_price = size_price;


                                  public int getSize_cost()
                                  return size_cost;


                                  public void setSize_cost(int size_cost)
                                  this.size_cost = size_cost;


                                  public int getSize_quantity()
                                  return size_quantity;


                                  public void setSize_quantity(int size_quantity)
                                  this.size_quantity = size_quantity;


                                  @Override
                                  public int describeContents()
                                  return 0;


                                  @Override
                                  public void writeToParcel(Parcel parcel, int i)
                                  parcel.writeString(product_name);
                                  parcel.writeString(product_photo);
                                  parcel.writeInt(product_sizes);
                                  parcel.writeString(product_created_date);
                                  parcel.writeInt(size_id);
                                  parcel.writeString(size_name);
                                  parcel.writeInt(size_price);
                                  parcel.writeInt(size_cost);
                                  parcel.writeInt(size_quantity);
                                  parcel.writeInt(product_id);





                                  You can use below code to move your array list to another activity.



                                  addToCartList=new ArrayList<>();
                                  Intent intent=new Intent(ShopingCart.this,SelectedProductFromShopingCartShow.class);
                                  intent.putParcelableArrayListExtra("selectedList",addToArrayList);
                                  startActivity(intent);


                                  Use below code to receive it in another activity.



                                  getIntent().getParcelableArrayListExtra("selectedList");



                                  For Android Studio the shortcut for implementing Parcelable interface is ALT+ENTER.
                                  Just implement the Parcelable interface with implementing the Java class.
                                  Android studio will intimate you with red error to implement and create the CREATOR. Android Studio will generate the beautiful code for you.
                                  That's it. Enjoy.








                                  share|improve this answer












                                  share|improve this answer



                                  share|improve this answer










                                  answered Nov 16 '18 at 6:48









                                  Prasad PHPrasad PH

                                  907




                                  907





















                                      0














                                      Your ShowProducts object must implements Parcelable.
                                      You can easily make your Object parcelable with an online tool like : http://www.parcelabler.com/



                                      This post can help you : How can I make my custom objects Parcelable?






                                      share|improve this answer



























                                        0














                                        Your ShowProducts object must implements Parcelable.
                                        You can easily make your Object parcelable with an online tool like : http://www.parcelabler.com/



                                        This post can help you : How can I make my custom objects Parcelable?






                                        share|improve this answer

























                                          0












                                          0








                                          0







                                          Your ShowProducts object must implements Parcelable.
                                          You can easily make your Object parcelable with an online tool like : http://www.parcelabler.com/



                                          This post can help you : How can I make my custom objects Parcelable?






                                          share|improve this answer













                                          Your ShowProducts object must implements Parcelable.
                                          You can easily make your Object parcelable with an online tool like : http://www.parcelabler.com/



                                          This post can help you : How can I make my custom objects Parcelable?







                                          share|improve this answer












                                          share|improve this answer



                                          share|improve this answer










                                          answered Jul 25 '17 at 12:42









                                          BubuBubu

                                          91878




                                          91878





















                                              0














                                              Please try this ...



                                              addToCartList=new ArrayList<>();
                                              Intent intent=new
                                              Intent(ShopingCart.this,SelectedProductFromShopingCartShow.class);
                                              intent.putStringArrayListExtra("selectedList", addToCartList);
                                              startActivity(intent);


                                              In Your receiving Activity...



                                              public class SelectedProductFromShopingCartShow extends AppCompatActivity
                                              ArrayList<ShowProducts> arrayList=new ArrayList<>();
                                              String condition="SelectedItemsFromShoppingCart";

                                              @Override
                                              protected void onCreate(Bundle savedInstanceState)
                                              super.onCreate(savedInstanceState);
                                              setContentView(R.layout.activity_selected_product_from_shoping_cart_show);
                                              arrayList= (ArrayList<ShowProducts>)
                                              getIntent().getStringArrayListExtra("selectedList");






                                              share|improve this answer





























                                                0














                                                Please try this ...



                                                addToCartList=new ArrayList<>();
                                                Intent intent=new
                                                Intent(ShopingCart.this,SelectedProductFromShopingCartShow.class);
                                                intent.putStringArrayListExtra("selectedList", addToCartList);
                                                startActivity(intent);


                                                In Your receiving Activity...



                                                public class SelectedProductFromShopingCartShow extends AppCompatActivity
                                                ArrayList<ShowProducts> arrayList=new ArrayList<>();
                                                String condition="SelectedItemsFromShoppingCart";

                                                @Override
                                                protected void onCreate(Bundle savedInstanceState)
                                                super.onCreate(savedInstanceState);
                                                setContentView(R.layout.activity_selected_product_from_shoping_cart_show);
                                                arrayList= (ArrayList<ShowProducts>)
                                                getIntent().getStringArrayListExtra("selectedList");






                                                share|improve this answer



























                                                  0












                                                  0








                                                  0







                                                  Please try this ...



                                                  addToCartList=new ArrayList<>();
                                                  Intent intent=new
                                                  Intent(ShopingCart.this,SelectedProductFromShopingCartShow.class);
                                                  intent.putStringArrayListExtra("selectedList", addToCartList);
                                                  startActivity(intent);


                                                  In Your receiving Activity...



                                                  public class SelectedProductFromShopingCartShow extends AppCompatActivity
                                                  ArrayList<ShowProducts> arrayList=new ArrayList<>();
                                                  String condition="SelectedItemsFromShoppingCart";

                                                  @Override
                                                  protected void onCreate(Bundle savedInstanceState)
                                                  super.onCreate(savedInstanceState);
                                                  setContentView(R.layout.activity_selected_product_from_shoping_cart_show);
                                                  arrayList= (ArrayList<ShowProducts>)
                                                  getIntent().getStringArrayListExtra("selectedList");






                                                  share|improve this answer















                                                  Please try this ...



                                                  addToCartList=new ArrayList<>();
                                                  Intent intent=new
                                                  Intent(ShopingCart.this,SelectedProductFromShopingCartShow.class);
                                                  intent.putStringArrayListExtra("selectedList", addToCartList);
                                                  startActivity(intent);


                                                  In Your receiving Activity...



                                                  public class SelectedProductFromShopingCartShow extends AppCompatActivity
                                                  ArrayList<ShowProducts> arrayList=new ArrayList<>();
                                                  String condition="SelectedItemsFromShoppingCart";

                                                  @Override
                                                  protected void onCreate(Bundle savedInstanceState)
                                                  super.onCreate(savedInstanceState);
                                                  setContentView(R.layout.activity_selected_product_from_shoping_cart_show);
                                                  arrayList= (ArrayList<ShowProducts>)
                                                  getIntent().getStringArrayListExtra("selectedList");







                                                  share|improve this answer














                                                  share|improve this answer



                                                  share|improve this answer








                                                  edited Jul 26 '17 at 5:37

























                                                  answered Jul 25 '17 at 12:42









                                                  Sachin ChauhanSachin Chauhan

                                                  897




                                                  897





















                                                      0














                                                      The following code works for me:



                                                       Intent intent = new Intent(this, editList.class);
                                                      intent.putStringArrayListExtra("list", list);
                                                      startActivity(intent);


                                                      You can get the result using:



                                                      ArrayList<String>() array_list = new ArrayList<String>();

                                                      array_list = getIntent().getStringArrayListExtra("list");





                                                      share|improve this answer





























                                                        0














                                                        The following code works for me:



                                                         Intent intent = new Intent(this, editList.class);
                                                        intent.putStringArrayListExtra("list", list);
                                                        startActivity(intent);


                                                        You can get the result using:



                                                        ArrayList<String>() array_list = new ArrayList<String>();

                                                        array_list = getIntent().getStringArrayListExtra("list");





                                                        share|improve this answer



























                                                          0












                                                          0








                                                          0







                                                          The following code works for me:



                                                           Intent intent = new Intent(this, editList.class);
                                                          intent.putStringArrayListExtra("list", list);
                                                          startActivity(intent);


                                                          You can get the result using:



                                                          ArrayList<String>() array_list = new ArrayList<String>();

                                                          array_list = getIntent().getStringArrayListExtra("list");





                                                          share|improve this answer















                                                          The following code works for me:



                                                           Intent intent = new Intent(this, editList.class);
                                                          intent.putStringArrayListExtra("list", list);
                                                          startActivity(intent);


                                                          You can get the result using:



                                                          ArrayList<String>() array_list = new ArrayList<String>();

                                                          array_list = getIntent().getStringArrayListExtra("list");






                                                          share|improve this answer














                                                          share|improve this answer



                                                          share|improve this answer








                                                          edited Aug 8 '17 at 4:44

























                                                          answered Jul 25 '17 at 12:45









                                                          Mahesh GawhaneMahesh Gawhane

                                                          287318




                                                          287318



























                                                              draft saved

                                                              draft discarded
















































                                                              Thanks for contributing an answer to Stack Overflow!


                                                              • Please be sure to answer the question. Provide details and share your research!

                                                              But avoid


                                                              • Asking for help, clarification, or responding to other answers.

                                                              • Making statements based on opinion; back them up with references or personal experience.

                                                              To learn more, see our tips on writing great answers.




                                                              draft saved


                                                              draft discarded














                                                              StackExchange.ready(
                                                              function ()
                                                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f45303371%2fhow-to-pass-array-list-object-to-another-activity%23new-answer', 'question_page');

                                                              );

                                                              Post as a guest















                                                              Required, but never shown





















































                                                              Required, but never shown














                                                              Required, but never shown












                                                              Required, but never shown







                                                              Required, but never shown

































                                                              Required, but never shown














                                                              Required, but never shown












                                                              Required, but never shown







                                                              Required, but never shown







                                                              Popular posts from this blog

                                                              Top Tejano songwriter Luis Silva dead of heart attack at 64

                                                              政党

                                                              天津地下鉄3号線