intent on Android - pass ArrayList to another activity -
I have two activities and I have ArrayList -> Activity B. From Activity A to Objects B Code is listed under section:
In Activity A:
Intent I = new intent (getApplicationContext (), SiteFoto fullscreen. Bundle meadata = new bundle (); MyData.putInt ("id", position); MyData.putInt ("MaxId", imgAdapter.getCount ()); MyData.putSerializable ("myObjArray", drawablesFromUrl); & Lt; ---- this objs i.putExtras (myData); StartActivity (i); Activity in
ArrayList & lt; Drawable & gt; MyObjArray = New ArrayList & lt; Drawable & gt; (); // Intent data means i = getIntent (); Bundle Mybandle = i.getExtras (); Status = myBundle.getInt ("id"); Maxid = myBundle.getInt ("MaxID"); MyObjArray = (ArrayList & lt; Drawable & gt;) i.getSerializableExtra ("myObjArray"); After executing the code, an error occurs:
AndroidRuntime (15005): java.lang.RuntimeException: Parcel: Marshall value and roid. Unable to graphics. Drable.bitmap driver @ 4052d928 Anyone can help me solve the problem, thanks thousands!
Pass your object through the parcelable . Here is a link that will show you how to do it relative easily:
Comments
Post a Comment