arrayadapter

Put your problem here if it does not fit any of the other categories.

arrayadapter

Postby euromaster » Wed Jun 18, 2008 7:11 pm

'm want to use an array to populate a list but i can't get my head aound the arrayadapter! could someone explain it for me?
euromaster
Junior Developer
Junior Developer
 
Posts: 14
Joined: Mon Jun 16, 2008 10:37 pm

Top

Postby Danuubz » Wed Jun 18, 2008 8:32 pm

There's some ArrayAdapter sample code at the API Demos:

http://code.google.com/android/samples/ ... List1.html
User avatar
Danuubz
Experienced Developer
Experienced Developer
 
Posts: 78
Joined: Wed Dec 19, 2007 10:44 pm
Location: Germany

Postby borya » Wed Jul 02, 2008 9:34 pm

In terms of using ArrayAdapters, you populate an ArrayList with the strings you want to appear in your list, then make a separate XML layout file that says how to display one generic item and then you make an ArrayAdapter with the context, the layout file you just made and the ArrayList passed to the constructor. Also in the layout file that you set as your content view in your ListActivity should contain a listview with the id list. If that doesn't make any sense, I think the examples in the post above will probably be more helpful :)
borya
Developer
Developer
 
Posts: 27
Joined: Wed Jul 02, 2008 7:50 pm
Location: California, USA

Postby plusminus » Thu Jul 03, 2008 8:51 am

Hello euromaster,

have a look at this tutorial, it shows the dynamic usage of a ArrayAdapter with a non-trivial class:
:arrow: viewtopic.php?t=2438

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 16 guests