Why is onNothingSelected method needed in spinner listener?

后端 未结 2 1300
温柔的废话
温柔的废话 2020-12-16 10:21

native English speaker, so I\'d say sorry about my bad English skills to you guys.

I\'ve been studing Android since 5 weeks ago. I tried to implement a spinner and m

2条回答
  •  醉梦人生
    2020-12-16 11:03

    As the documentation describes:

    Callback method to be invoked when the selection disappears from this view. The selection can disappear for instance when touch is activated or when the adapter becomes empty.

    This means that the method is called whenever the currently selected item is removed from the list of available items. As the doc describes, this can occur under different circumstances, but generally if the adapter is modified such that the currently selected item is no longer available then the method will be called.

    This method may be used so that you can set which item will be selected given that the previous item is no longer available. This is instead of letting the spinner automatically select the next item in the list.

提交回复
热议问题