load - Android : Set a value from an external file in a spinner -


i'm stuck on problem spinners.

actually, have tabs spinners , edittext create without porblems. have keep datas user type in xml file. create xml file , workd fine.

i have loading tab permis load datas saved in xml. load file, parse , fill edittexts without problems.

the problem spinner : can't put data xml created in spinner.

i tried saving string , tried load in spinner way :

(spinner) spinner.setprompt(string); 

that doesn't work, have default value not saved value. tried save integer of choice made user. , reload way :

(spinner) spinner.setselection(integer.parseint(string)); 

i don't think use cause have fc.

so don't know how proceed load value xml in spinner.

any idea ?

thanks !

try this:

string mystring = "some value"; //the value want position  arrayadapter myadap = (arrayadapter) myspinner.getadapter(); //cast arrayadapter  int spinnerposition = myadap.getposition(mystring);  //set default according value myspinner.setselection(spinnerposition); 

from: how set selected item of spinner value, not position?


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -