0

2つのアクティビティがあり、ArrayList->drawablesFromUrlobjsをアクティビティ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

誰でも私が問題を解決するのを手伝ってくれる、何千もの感謝!

4

1 に答える 1

0

を介してオブジェクトを渡しますParcelable。これは、比較的簡単にそれを行う方法を示すリンクです。

http://shri.blog.kraya.co.uk/2010/04/26/android-parcel-data-to-pass-between-activities-using-parcelable-classes/

于 2012-07-12T03:52:58.343 に答える