Android : Invoke a listener in a specified function

on Sunday, August 10, 2014


I have a preferenceListener in which i listen to changes in the preference



preferenceListener = new OnSharedPreferenceChangeListener() {
@Override
public void onSharedPreferenceChanged(
SharedPreferences sharedPreferences, String key) {
if (key.equals(SettingsActivity.CAR)
{ }

}

}
};


But i want to invoke this listener in onResume() only. Means if the activity goes into onResume() and my preference is changed, then only i want to invoke this listener. How to achive this?


0 comments:

Post a Comment