I need to make a 2D arraylist like
[[1,2,3],[2,3,4],[3,4,5]]
But by using the below code I am getting only
[[3,4,5],[3,4,5],[3,4,5]]
The last array simply gets repeated again and again. While traversing through the problem, I found that in first pass its like
[[1,2,3]
2nd pass:
[[2,3,4],[2,3,4]]
3rd pass:
[[3,4,5],[3,4,5],[3,4,5]].
Please help, as i m stuck with it.
ArrayList<ArrayList<Integer>> combiarray = new ArrayList<ArrayList<Integer>>();
ArrayList<Integer> innerarray = new ArrayList<Integer>();
combiarray.clear();
for(k=1;k<(row*column);k=k+column)
{
for(j=k;;j++)
{
innerarray.clear();
for(i=0;i<wincount;i++)
{
innerarray.add(j+i);
}
combiarray.add(innerarray);
Toast.makeText(context,String.valueOf(combiarray),
Toast.LENGTH_SHORT).show();
i--;
if((j+i)%column==0)
{
break;
}
}
}
