android - how to pass Array list <Object> to another activity -


i pass array list intent give error . please tell me wrong. code

for sending

addtocartlist=new arraylist<>(); intent intent=new intent(shopingcart.this,selectedproductfromshopingcartshow.class); intent.putextra("selectedlist", (serializable) addtocartlist); startactivity(intent); 

and 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 error

07-25 20:15:54.280 16503-16503/com.sizdom.sizdomstockmanager e/androidruntime: fatal exception: main java.lang.runtimeexception: parcel: unable marshal value showproducts{product_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'} @ android.os.parcel.writevalue(parcel.java:1235) @ android.os.parcel.writelist(parcel.java:622) @ android.os.parcel.writevalue(parcel.java:1195) @ android.os.parcel.writemapinternal(parcel.java:591) @ android.os.bundle.writetoparcel(bundle.java:1627) @ android.os.parcel.writebundle(parcel.java:605) @ android.content.intent.writetoparcel(intent.java:6660) @ android.app.activitymanagerproxy.startactivity(activitymanagernative.java:1865) @ android.app.instrumentation.execstartactivity(instrumentation.java:1424) @ android.app.activity.startactivityforresult(activity.java:3370) @ android.support.v4.app.basefragmentactivityjb.startactivityforresult(basefragmentactivityjb.java:50) @ android.support.v4.app.fragmentactivity.startactivityforresult(fragmentactivity.java:79) @ android.app.activity.startactivityforresult(activity.java:3331) @ android.support.v4.app.fragmentactivity.startactivityforresult(fragmentactivity.java:859) @ android.app.activity.startactivity(activity.java:3566) @ android.app.activity.startactivity(activity.java:3534) @ com.sizdom.sizdomstockmanager.shopingcart$1.onclick(shopingcart.java:66) @ android.view.view.performclick(view.java:4204) @ android.view.view$performclick.run(view.java:17355) @ android.os.handler.handlecallback(handler.java:725) @ android.os.handler.dispatchmessage(handler.java:92) @ android.os.looper.loop(looper.java:137) @ android.app.activitythread.main(activitythread.java:5069) @ java.lang.reflect.method.invokenative(native method) @ java.lang.reflect.method.invoke(method.java:511) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:793) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:560) @ 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 unrecoverably broken , disposed! 07-25 20:20:54.325 700-910/system_process e/inputdispatcher: channel '535f9848 com.sizdom.sizdomstockmanager/com.sizdom.sizdomstockmanager.mainactivity (server)' ~ channel unrecoverably broken , 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: not find class 'android.graphics.drawable.rippledrawable', referenced 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;     }  } 

please write showproducts implements serializable in model class.
resolve issue.


Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -