Spinner's onItemSelected callback called twice after a rotation if non-zero position is selected

后端 未结 8 1235
执念已碎
执念已碎 2021-02-03 20:52

When I create my activity, I setup a Spinner, assigning it a listener and an initial value. I know that the onItemSelected callback is called automatically during a

8条回答
  •  天命终不由人
    2021-02-03 21:15

    Managed to find a solution in another stackoverflow question:

    spinner.post(new Runnable() {
        public void run() {
            spinner.setOnItemSelectedListener(listener);
        }
    });
    

提交回复
热议问题