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

后端 未结 12 1173
慢半拍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:18

        This following method will help you to stop invoking automatically the selection listener
    
    
        yourspinnerobj.post(new Runnable() {
                    @Override
                    public void run() {
                        yourspinnerobj.setOnItemSelectedListener(yourspinnerlistener);
                    }
                });
    

提交回复
热议问题