I want to show a Toast right after the user clicks on a CheckBoxPreference in my PreferenceActivity.
myCheckBox.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Toast.makeText(Prefs.this,
"test",
Toast.LENGTH_SHORT).show();
doSomething();
return false;
}
});
I also tried to put the Toast into the doSomething() method, but it's always shown after the whole method is processed. I tried getBaseContext()
instead of Prefs.this
, but it didn't help.
Any idea why the Toast doesn't show up at once and how to make it do so?