Add extra element to cursor adapter android

Sandra picture Sandra · Sep 19, 2012 · Viewed 9.4k times · Source

I have a Cursor that contains all rows from my database. That Cursor I pass to a CursorAdapter, and display the data in a list. But I need to show one extra element in the beginning. How can I do that?

I read somewhere that maybe it can be done with a CursorWrapper, and it can inject extra values into the results. But I'm not quite sure how to do that.

If someone can show me an example (code), or have another idea how to solve this, please let me know. Thx!

Answer

naktinis picture naktinis · Jan 31, 2013

How about using a combination of MergeCursor and MatrixCursor as I've suggested in this question: How to insert extra elements into a SimpleCursorAdapter or Cursor for a Spinner?