Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Android
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Android
reference a string array defined in external resources in custom listview
ghouse mohammed
Greenhorn
Posts: 15
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
hi how can i reference a
string
array defined in external resources in custom listview and i want to add it to the listview in the below code
public class ListTestActivity extends ListActivity { /** Called when the activity is first created. */ String tag = "Events"; String[] presidents; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Create an array of Strings, that will be put to our ListActivity presidents =getResources().getStringArray(R.array.presidents_array); ArrayAdapter<Model> adapter = new InteractiveArrayAdapter(this, getModel()); Log.d(tag," event"); setListAdapter(adapter); } private List<Model> getModel() { Log.d(tag,"bht"); List<Model> list = new ArrayList<Model>(); list.add(get("Linux")); Log.d(tag,"bht1"); list.add(get("Windows7")); list.add(get("Suse")); list.add(get("Eclipse")); list.add(get("Ubuntu")); list.add(get("Solaris")); list.add(get("Android")); list.add(get("iPhone")); // Initially select one of the items list.get(1).setSelected(true); //String re=list.get(1); Log.d(tag," event1"); return list; } private Model get(String s) { Log.d(tag," event2"); return new Model(s); } }
Eliminate 95% of the weeds in your lawn by mowing 3 inches or higher. Then plant tiny ads:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Hashmap in android
How to Create two parallel listViews where each list view contains a text and a icon
how can we view the two lists on a single display???
Can not click on listView
listview with checkbox problem
More...