I have an if loop when a chebkox in sharedpreferences changed status. But I'm not able to set putBoolean("blabla", false);
when the status changed.
For example: User hits checkbox, CB gets checked, if says uncheck it
but it won't uncheck.
My Code:
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
if(key.equals("cbSaveUsername")) {
SharedPreferences.Editor SFEdit2 = sharedPreferences.edit();
SFEdit2.putBoolean("cbSaveUsername", false);
SFEdit2.commit();
}
}
Can anyone tell me my mistake?
Edit: It looks like it works programatically but the tick is still in the box :o Where could be the mistake? I use it like Gunaseelan postet