Developer wrote:
> Suppose I get a cursor that contains all rows from my database, and I
> want to show them on a spinner, the following code will work. But I
> want to show two extra items as the spinner elements, how can I add
> those two elements?
> 
> For example, if the following code can show 4 spinner elements
> "Orange" "Apple" "Cabbage" "Green Onion", how can I add an element in
> the spinner saying "All fruit" "All Vegetable"?

Here are some ideas...

Option #1: Put the extra two in the database.

Option #2: Don't pass the Cursor into SimpleCursorAdapter, but rather
iterate over the Cursor, put the results into an ArrayList or something,
and use that with an ArrayAdapter.

Option #3: Create a CursorWrapper that injects your two extra values
into the results.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
_The Busy Coder's Guide to Android Development_ Version 2.0 Published!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to