MolhamStein
MolhamStein

Reputation: 627

expandable list view with xml entries

i want to display an expandable list view in android that contains constant strings defined in a XML file in the resources my app should support multiple languages so its the cleanest way to keep all strings together

i know its possible in normal listView where i can use the property

android:entries="@array/stringarray"

but when i use it with expandable list it gives me an exception that i should use expandable list adapter instead of list adapter even know that i am not using any adapters "i think its implicit"

so obliviously "entries" is usable with expandable lists but cant find a way to make it work

any suggestions are welcome

Upvotes: 1

Views: 1194

Answers (1)

nstosic
nstosic

Reputation: 2614

Well I think the easiest solution is to create an Expandable list adapter object and bind it to the expandable list object. When you add all the members of string array to the adapter elements, the expandable list will be modified accordingly. Look at the SimpleExpandableListAdapter constructors to find out how to implement the idea mentioned above.

Upvotes: 1

Related Questions