Android Spinner: Set selected item as default

后端 未结 4 463
甜味超标
甜味超标 2021-01-14 06:22

I am making an android app that asks for the users to select a country via spinner.

When the user opens the app first time, user selects a country from list.

<
4条回答
  •  旧巷少年郎
    2021-01-14 06:52

    You can use sharedPreference to store the country you have chosen, then search the map and find the position of country in your array, finally use setSelection(int position)to set the default country

提交回复
热议问题