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[]
'Bundle Array'這是什麼? –
Bundle []或bundle.toArray() – Mohammad7G
是否足夠,但是ONE包中的項目是否需要包含數組? –