2012-07-12 48 views
0

我有兩個活性和我想傳遞的ArrayList - > drawablesFromUrl OBJ文件從活動A到活動B.代碼的部分列出如下:在Android意圖 - 傳遞的ArrayList <Drawable>到另一個活動

在活性甲:執行該代碼

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 [email protected] 

任何人都可以幫助我解決問題,萬分感謝!

+0

我記得你並不需要序列可繪製和位圖... – 2012-07-12 03:28:36

+0

但如何從活動轉移可繪製和位圖A到活動B?謝謝!@ – user1411475 2012-07-12 03:34:48

+0

看到這個答案:http://stackoverflow.com/questions/11387603/how-to-pass-a-arraylistbitmap-between-activities/11387685#11387685 – azgolfer 2012-07-12 03:49:52

回答

相關問題