setSelection on Spinner based on rowId
Posted
by awiden
on Stack Overflow
See other posts from Stack Overflow
or by awiden
Published on 2010-04-01T10:13:16Z
Indexed on
2010/04/01
11:03 UTC
Read the original article
Hit count: 676
Hi!
I have a Spinner View that's populated through a SimpleCursorAdapter. Based on the selection I need to save the rowid in the entry database (position won't work because things can be added and deleted from the Spinner Database). This I can do by using spinner.getAdapter().getItemId(pos) . But When I edit an entry I need to make the Spinner position selected that is associated with this rowid (currently).
spinner.setSelection(position) won't work because I have the rowid, I need a way to find the current position of the item in the current spinner based on the rowid in the database.
© Stack Overflow or respective owner