开发者

Android: An array of arrays and a listview

开发者 https://www.devze.com 2023-04-05 05:49 出处:网络
I\'ve read a java tutorial explaining an \"array of arrays\" with something similar to coordinates. For instance,

I've read a java tutorial explaining an "array of arrays" with something similar to coordinates. For instance,

mainArray [0] [0] = "arrayA";
mainArray [0] [1] = 1;
mainArray [0] [2] = 2;
mainArray [1] [0] = "arrayB";
mainArray [1] [1] = 1;

Is it plausable to populate a listview using this type of array in android (using the first set of numbers 开发者_如何学Goand not the subset)? I haven't had the chance to try it yet.


Yes, it is possible.

You have to write a custom ListAdapter preferable extending ArrayAdapter.

Look at http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/List14.html


A better option would be to define a "coordinates" object and then make an array or list of those objects. Then use that to populate your ListView.

0

精彩评论

暂无评论...
验证码 换一张
取 消