arrays - Android - Spinners -



arrays - Android - Spinners -

i have question , know has been asked 1000000 times, new android programming. kinda boggled.

i have created 2 parallel arrays - containing phrases in 2 languages.as spinner changes value(from 1st array) - textview should updated reflect translated phrase (in sec array).

the 2 arrays created in string.xml, similar below , spinner gets value there.

<string-array name="array_name"> <item>phrase1</item> <item>phrase2</item> <item>phrase3</item> <item>phrase4</item> </string-array>

im not sure how go doing or if viable way of doing it.... boggled remain....

can please help?

you should set onitemselectedlistener spinner , alter text

spinner.setonitemselectedlistener(new adapterview.onitemselectedlistener() { @override public void onitemselected(adapterview<?> parent, view view, int position, long id) { textview.settext(getresources().gettextarray(r.array.array_name)[position]); } @override public void onnothingselected(adapterview<?> parent) { } });

android arrays

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -