I am trying to save the state of the check box to shared preferences from whatever the user leaves it in after they finish using the app. I know how to store data in shared preferences, I am storing edittext but I also need to store the state of a check box. I've been trying to figure out how to do it, but not able to for a long time.
editor.putString("savedCheckbox", pizzaCB. ... )
OR
editor.putBoolean("savedCheckbox", pizzaCB. ... )
I am not sure what to put after pizzaCB (name for my checkbox), which gets its state, I tried .getSelectedState but it doesn't seem to exist! Could someone please help me out.
Aucun commentaire:
Enregistrer un commentaire