2015-07-20 63 views
0

我有Bundle数组,我将它发送到另一个活动如何将捆绑数组发送到其他活动?

变送器:

List<Bundle> items = new ArrayList<>(); 
// add items 

Intent intent = new Intent(this, Dialog.class); 
intent.putExtra("items", items.toArray()); 
startActivity(intent); 

接收机:

Bundle[] items = (Bundle[]) getIntent().getExtras().getSerializable("items"); 

但它返回错误:

E/AndroidRuntime﹕ FATAL EXCEPTION: main 
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.myApp/com.example.myApp.items.ReceverActivity}: java.lang.ClassCastException: java.lang.Object[] cannot be cast to android.os.Bundle[] 
+0

'Bundle Array'这是什么? –

+0

Bundle []或bundle.toArray() – Mohammad7G

+0

是否足够,但是ONE包中的项目是否需要包含数组? –

回答

相关问题