How to disable onItemSelectedListener to be invoked when setting selected item by code

后端 未结 12 1166
慢半拍i
慢半拍i 2021-02-02 08:05

Just wondering how you handle the following problem: a result is calculated depending on two spinners\' selected items. To handle the UI things, i.e. a user picks a new item in

12条回答
  •  一生所求
    2021-02-02 08:34

    I created a library that help for all, that no need to call item onClick action in Spinner For example:

    spinner.setSelection(withAction,position);
    

    where withAction is a boolean flag, that used for call or not item action

    Link on Github: https://github.com/scijoker/spinner2

提交回复
热议问题