In android studio how could we associate spinner and edittext... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

In android studio how could we associate spinner and edittext...

android studio contain a tool called spinner and edit text , spinner is like" select from list " option and so edit text is editable , and i need to select something in that list, with respect to my selection ,edittext should be changed

23rd Dec 2016, 11:42 AM
Priyanka sundar
Priyanka sundar - avatar
2 Answers
+ 2
spinnername.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) { // your code //get the selected item from the array you passed //to the spinner adapter by the position //e.g. editText.setText(yourItemsArray[position]); } @Override public void onNothingSelected(AdapterView<?> parentView) { } });
31st Dec 2016, 1:48 PM
Ahmad Samy
Ahmad Samy - avatar
+ 2
could u explain more plzzzz
5th Feb 2017, 11:03 AM
Priyanka sundar
Priyanka sundar - avatar