2011-11-09 66 views
1

如何從一個活動傳遞類別列表(即列表)到另一個活動。 例如我有以下的JSON: -傳遞列表<Class>從一個活動到另一個活動

{ 
"acclst":[{ 
    "accountInfoData":[{ 
      "userId":9, 
      "rid":"1-Z5S3", 
      "acnme":"acc_1234.", 
      "actpe":"Fabricator/Distributor", 
      "mph":"2660016354", 
      "euse":"Biofuels", 
      "com":"0", 
      "sta":"Active", 
      "stem":"BBUSER5", 
      "wsite":"", 
      "fax":"", 
      "zone":"", 
      "crted":"BBUSER4", 
      "statusX":1, 
      "partyId":0, 
      "address":[] 
     } 
    ] 
} 
], 
"conlst":[], 
"actlst":[], 
"prolst":[], 
"code":"200" 
} 

因此,如何如何從一個活動傳遞到另一個的conlst任何示例將幫助我嗎?

回答

0

您可以在捆綁包中添加列表並將捆綁包放入Intent。

Intent i = new Intent(currentActivity.this,nextActivity.class); 
Bundle bundle = new Bundle(); 
bundle.putSerializable("key",conlst); 
i.putExtras(packData); 
startActivity(i); 

否則使您的類從列表parcelable | http://developer.android.com/reference/android/os/Parcelable.html,並把它們捆綁在一起 -

Bundle bundle = new Bundle(); 
bundle.putParcelableArrayList("key",conlst);  
i.putExtras(packData); 
startActivity(i); 
相關問題