我设置了下面的代码。android arraylist无法设置对象
ArrayList<RectF> rects1x1 = new ArrayList<RectF>();
ArrayList<ArrayList<RectF>> arrayedRects = new ArrayList<ArrayList<RectF>>();
,并在同一个类的方法,编写代码:
public void SetDots(int many)
{
switch(shapeID)
{
case 3:
for(int i=0; i<3; i++)
{
for(int j=0; j<100; j++)
{
rects1x1.add(new RectF(j , j , i+110 , i+50));
}
arrayedRects.add(rects1x1);
}
break;
,但我认为此ArrayList和ArrayList不能救另一个数组列表或数据。
我能做些什么来解决它?
你可以......但是,你必须创建第二循环开始前内部数组的新实例...在你的你正在向arraylist的arraylist添加相同的arraylist代码 – Selvin