【发布时间】:2016-09-29 08:41:47
【问题描述】:
我想在二维数组列表中设置/获取一个值。 像这样,
[0] [1] [2]
[0] true false true
[1] true true true
[2] true false false
[3] false true true
我的代码 :
Arraylist<Arraylist<Boolean>> checkBoxState= new Arraylist<Arraylist<Boolean>();
得到:
checkBoxState.get(position).get(h);
设置:
checkBoxState.get(position).set(h,true);
- 位置、h 是 int 变量
但我的设置/获取代码不起作用。 如何设置/获取 checkBoxState(0.3)?
谢谢。
【问题讨论】:
-
您面临什么问题?
-
如何在二维数组列表中获取和添加数据?
-
你添加了足够的
ArrayList<Boolean>到checkBoxState吗?您尝试修改/获取的列表有足够的布尔值吗? -
对于外层
ArrayList的每个位置,都需要创建一个ArrayList。
标签: java android list arraylist