我有两个活动,我想将 ArrayList -> drawablesFromUrl objs 从活动 A 传递到活动 B。部分代码如下所示:
在活动 A 中:
Intent i = new Intent(getApplicationContext(),SitePhotoFullScreen.class);
Bundle myData = new Bundle();
myData.putInt("id", position);
myData.putInt("MaxId", imgAdapter.getCount());
myData.putSerializable("myObjArray",drawablesFromUrl);<---- this objs
i.putExtras(myData);
startActivity(i);
在活动 B
ArrayList<Drawable> myObjArray = new ArrayList<Drawable>();
// get intent data
Intent i = getIntent();
Bundle myBundle = i.getExtras();
position = myBundle.getInt("id");
MaxId = myBundle.getInt("MaxId");
myObjArray = (ArrayList<Drawable>) i.getSerializableExtra("myObjArray");
执行代码后,出现错误:
AndroidRuntime(15005): java.lang.RuntimeException: Parcel: unable to marshal value android.graphics.drawable.BitmapDrawable@4052d928
任何人都可以帮助我解决问题,万分感谢!