java - Check if checkBoxPreference is "true" -


i have preferences 10 checkboxpreferences , need list how checked, eg 6/10 idea?
tried something, absolutely failed.

i believe you're talking checkboxpreference class in android, in case need register sharedpreferences.onsharedpreferencechangelistener , implement method:

private static final string checkbox_key = "your_checkboxpreference_key";  @override public void onsharedpreferencechanged(sharedpreferences sharedpreferences, string key) {   if(key.equals(checkbox_key)) {     if(sharedpreferences.getboolean(key, true)) {       //your code here     }   } } 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -