android - How to get back spinner data -


i filled spinner query.

how can retrieve information selected? i'm having trouble getselecteditem(position)..

i have cursor save query, fill spinner that's no problem. don't know how assign string variable selected in spinner.

for example

spinnername.setonitemselectedlistener(             new adapterview.onitemselectedlistener() {             public void onitemselected(adapterview<?> parent,                 android.view.view v, int position, long id) {                     selentidad = ??;             }              public void onnothingselected(adapterview<?> parent) {                   selentidad ="nodata";             }     }); 

how can put in selentidad value of selected in spinner, filled query?

if pass strings spinner should able corresponding string with
(string) parent.getitematposition(position).

getitematposition return object adapter uses construct views. in case of simplecursoradapter cursor @ position. can cast returned object cursor , query data. e.g. getstring(0) if have string in first column of queried cursor.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -