Reputation: 1261
I essentially want to do the following:
switch.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
Boolean newVal = (Boolean) newValue;
if (newVal && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !Settings.canDrawOverlays(getApplicationContext())) {
switch.setChecked(false);
displaySettingsDialog();
return true;
}
switch.setChecked(false);
does not appear to execute, and the switch will toggle on while displaySettingsDialog()
happens. How do I get around this?
Upvotes: 0
Views: 448