Mr.Radar Mr.Radar - 1 year ago 78
Android Question

Android ExpandableList with static items/without adapter

In my app, there is an Activity which contains a lot of Views (editText-fields,...). Because of that the screen is too small to fit all the views. Therefore I want to use an ExpandableList which contains all the views semantically grouped (as Layouts) to list items.

Is there an easy way to get this done? Implementing an Adapter seems to be a bit complicated, regarding that the list should only contain "static" views.

Something like this would be nice:

public void onCreate(Bundle savedInstanceState) {
ExpandableListView lv = (ExpandableListView) findViewById(;
EditText et = (EditText) lv.getItem(1).findViewById(;

Answer Source

I've written an own adapter extending BaseExpandableListAdapter. In the adapter i keep instances of the layouts to display as class variables - not the best solution regarding performance, but a convenient solution. As there is only a fixed short number of items to display, the performance issue won't bother much.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download