Daniel Novak
Daniel Novak

Reputation: 2756

Listview bound with Cursor adapter - how to add default first entry

What is the common way to add a first default item to the listview, which takes it's data from a CursorAdapter? I would like to have a listview with items where the first entry is something like "Add item". Making a custom adapter won't help because it would mess up the cursor item count.

Upvotes: 1

Views: 734

Answers (2)

max4ever
max4ever

Reputation: 12142

Try using a select with union

like

select 'Select something' as denominazione, 0 as _id union select denominazione, id as _id from ditta order by id asc

Upvotes: 0

Flavio
Flavio

Reputation: 6235

In your situations the best solution is using the method addHeaderView.

Why do u want taking data from cursorAdapter for the first item? Just set a TextView as a header view.

Upvotes: 1

Related Questions