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
Win a copy of
Java Persistence with Spring Data and Hibernate
this week in the
Spring
forum!
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
Ron McLeod
Tim Cooke
Paul Clapham
Liutauras Vilda
Sheriffs:
Junilu Lacar
Rob Spoor
Jeanne Boyarsky
Saloon Keepers:
Stephan van Hulst
Carey Brown
Tim Holloway
Piet Souris
Bartenders:
Forum:
Android
reference a string array defined in external resources in custom listview
ghouse mohammed
Greenhorn
Posts: 15
posted 11 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); } }
Good heavens! What have you done! Here, try to fix it with this tiny ad:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
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...