我有问题在Fragment
中获得的Bundle
以上。如何获得不止一个包中的一个片段
用我的代码,我从活动传递数据,但没有获取片段中的值数据。
ACTIVITY:
Bundle bundle = new Bundle();
bundle.putIntegerArrayList("oki", hm);
bundle.putIntegerArrayList("okiquantitapizze", hm_quantitàpizze);
System.out.println("PERO:" + bundle);
MyListFragment myFragment = new MyListFragment();
myFragment.setArguments(bundle);
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.a, myFragment);
transaction.commit();
FRAGMENT:
try {
bundle = getArguments();
System.out.println("BUNDLES1:" + bundle);
if (bundle != null) {
strtext = bundle.getIntegerArrayList("oki");
quantitàpizze=bundle2.getIntegerArrayList("okiquantitapizze");
System.out.println("CAZZ:" + strtext);
System.out.println("PRESO:" + quantitàpizze);
}
} catch(Exception e){
}
什么是'bundle2'? – nikis
你试图获得参数的哪个片段的方法? – artemiygreg
@nikis是的,bundle2是问题.... – androidiano