android - Creating headers in custom ArrayAdapter from values passed to constructor -
i have list of items database ordered rooms:
list<item> items = database.getallitemsorderedbyroom();
every item has roomid, , few other properties.
and have customitemsarrayadapter works items doesn't create headers.
what want create list not items, room headers based on values passed inside items. work like:
long actualroom = null; for(item item : items){ long itemroom = item.getroom; if(itemroom != actualroom){ actualroom = itemroom; list.putroomheader(actualroom); list.putitem(item); } else { list.putitem(item); } }
i have working inside customitemsarrayadapter after using constructor: adapter = new customitemsarrayadapter(context, items); stumbled upon explanation how headers: android listview headers , makes me prepare values list before creating adapter , unconvenient if use few similar lists in app.
is there way of processing values inside constructor of costomitemsarrayadapter?
use expandable list view,
visit http://developer.android.com/reference/android/widget/expandablelistadapter.html
use groupview section.
Comments
Post a Comment