TMH
TMH

Reputation: 6246

Android ListView with section titles

I need to set up a ListView that has section titles.

I have my data formatted as such

List is the root Each entry has: a day field (which will be the section title) a classes field which is a JSONArray The classes JSONArray has a number of JSONObjects in it containing text I need to display in the list

If I want to display the above data as section ListView would I be better separating the data into 2 Lists? Or could I do it all in the one list?

Upvotes: 0

Views: 123

Answers (1)

getKonstantin
getKonstantin

Reputation: 1250

Try MergeAdapter commons ware

Example:

mergeAdapter = new MergeAdapter(); 
mergeAdapter.addView(sectionView1); 
mergeAdapter.addAdapter(listAdapter1); 
mergeAdapter.addView(sectionView2); 
mergeAdapter.addAdapter(listAdapter2); 

And later set this adapter to your list

Upvotes: 1

Related Questions