Save SWITCH button state, and recover state with SharedPrefs

前端 未结 2 887
误落风尘
误落风尘 2021-01-16 18:27

I have a Settings class so the user can decide to subscribe/unsubscribe to channels in Parse Push.

I think I got it all figure out except for the part to recover, a

2条回答
  •  被撕碎了的回忆
    2021-01-16 19:17

    Override the onCreate method of that activity class and attempt to load the values you saved in SharedPreferences.

    krspush.setChecked(sharedPrefs.getBoolean("onKrsClick",false));
    

提交回复
热议问题