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

后端 未结 8 1043
执念已碎
执念已碎 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:13

    You can just call to setSelection once you know have the list of items and the position to be selected, in that way you avoid onItemSelected to be called twice.

    I've created an article about what I think is a better approach How to avoid onItemSelected to be called twice in Spinners

提交回复
热议问题