How To Display 2D Array In Gridlayout
I have Array [] [] myArray = new Array [5] [5], or Array [] [] myArray = new Array [7] [9], or new Array [12] [13] I want to display the array in GridLayout. I found many examples
Solution 1:
Simple thing you can do is, you can convert 2D array to a simple 1D array (using a for loop) and proceed as usual. And if you need to set the items dynamically (I mean, if you do not know the dimensions of the array before hand), then you have use the setColumnCount() to set the number of columns you need (5,9,13 in your examples). You don't have to wo0rry about the number rows as Android takes care of the rows. And yes, you should use BaseAdapter.
Post a Comment for "How To Display 2D Array In Gridlayout"