-1
我得到这个错误:ArrayList中传递到另一个活动的Android
在行,其中我想提出的ArrayList ..
我在做什么错?
我的代码:
List<Integer> skatlice = Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
...
if (cases[position] == 1) {
myIntent2 = new Intent(Game.this, Skatle.class);
vrednostskatel = 1;
myIntent2.putExtra("vrednostskatel", vrednostskatel);
skatlice.set(0, 1);
myIntent2.putIntegerArrayListExtra("skatlice", ArrayList<Integer> skatlice);
startActivity(myIntent2);
overridePendingTransition(R.layout.mainfadein, R.layout.splashfadeout);
}
你应该删除的ArrayList在此行中 'myIntent2.putIntegerArrayListExtra( “skatlice”,ArrayList的 skatlice);' 它看起来像 'myIntent2.putIntegerArrayListExtra( “skatlice”,skatlice); ' –
Apple
@Apple然后我得到这个错误:类型意图中的方法putIntegerArrayListExtra(String,ArrayList)不适用于参数(字符串,列表) –
ribicincc
我认为您应该将您的列表转换为ArrayList,您应该放回ArrayList但用括号和括号括起来。它看起来像这样 'myIntent2.putIntegerArrayListExtra(“skatlice”,(ArrayList )skatlice);' –
Apple