I have a spinner with some items (strings). I want to add the selected items to a list. I read online that I should use the onItemSelectedListenerrather than the
onItemSelectedListener
(in Kotlin)Use this code:
yourSpinner?.onItemSelectedListener = object : AdapterView.OnItemSelectedListener{ override fun onNothingSelected(parent: AdapterView<*>?) { } override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) { } }