开发者

display two columns from rows in a multidimensional array in listview - android

I've been trolling for some time now trying to find a way to implement this but have come up dry. Let me state that I am fairly new to java/android development so please be gentle.

What I have is a multidimensional array giving info about a store location like so

static final String[][] coordinates = new String[][] {
    {"1","location_name", "managername","geo:geolocation?z=10" },
    {"2","location_name","managername","geo:geolocation?z=10" },
    {"3","location_name","managername","geo:geolocation?z=10" },
    {"4","location_name","managername","geo:geolocation?z=10" }

};

What I am trying to do is just pull the LOCATION_NAME and MANAGERNAME from the array per row, and display it in a list view using the layout xml described here, http://android-developers.blogspot.com/2009/02/android-layout-tricks-1.html.

I was reading that it might be best to use the matrix cursor to implement this, but as being new to java development, i'm a bit confused as to how I'd go about doing this.

Anyone have any ideas that can guide me in the right direction?

Thanks, Ryan

EDIT: I should note, I decided to change to a simpler method of implemenation... as l开发者_C百科east for now. NOW, I am using just two single dimension arrays, one for LOCATION_NAME and one for MANAGER_NAME. I am using the 2 row layout described in the link. Where I am running into a snag is in the IconicAdapter. How to I fill both (inner) rows of each row with a separate string? This is what I have, which i know is wrong.

class IconicAdapter extends ArrayAdapter<String>{
   IconicAdapter(){
       super(about.this, R.layout.about_layout, R.id.title, locations);
       super(about.this, R.layout.about_layout, R.id.secondLine, managers);
   }


You will need to subclass ArrayAdapter and override getView(). Here is a free excerpt from one of my books that covers how this is done.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜