I need to display data from a database in a list. I get all the data in a group by category and displayed in a Listview. I used the following code.
private ListView infos; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ......... ......... infos = new ListView(this); model = infoDataHelper.getCursor(addType); adapter = new InfoAdapter(model); infos.setAdapter(adapter); ......... ......... } class InfoAdapter extends CursorAdapter { public InfoAdapter(Cursor c) { super(getParent(), c);
Now I want to add the category category heading to the result set so that it looks like this:
Categoty Fruit Apple Mango Grape Category Flower Rose Lotus Jesmine
etc.
How can i do this? Does addHeaderView work for this? If so, how can I add it?
source share