Android Kotlin onItemSelectedListener for spinner not working

后端 未结 6 1134
盖世英雄少女心
盖世英雄少女心 2021-02-03 18:12

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

6条回答
  •  情书的邮戳
    2021-02-03 18:34

    string will not be able to check using '==' instead you need to use equals("string")

    if (selectedItem.equals("Add new category")) {
                // do your stuff
            }
    

提交回复
热议问题