I want to populate my Android spinner with data from a SQLite table. I already have the database controllers, and these are returning custom objects.
Now what I need to do is populate the spinner with this objects, in order to get not the string field, but the Id field. For example: My table Days, with fields Id and Day:
id - day 1 - Sunday
2 - Monday
3 - Tuesday...
And the Day object has two properties (id, and name)
I want the spinner to show "Monday", but internally, store the Id field '2' in an int variable, in order to query again the database with theese selected values.
I think I have to do it with an Adapter, but I don't know if I can do what I want with this controller.
I'd apreciate some order or advice to begin with.
Thanks
Aucun commentaire:
Enregistrer un commentaire