-1

I want to make an if function that it's condition is to check if a sharedpreference changed or not, any idea on how to make this, thanks.

  • Have you looked at Context.getSharedPreferences() (http://developer.android.com/reference/android/content/Context.html#getSharedPreferences%28java.lang.String,%20int%29)? – lambda.xy.x May 09 '15 at 11:03

1 Answers1

2

you can use registerOnSharedPreferenceChangeListener, to register a listener that will be invoked when a change in the preference occurs. Don't forget to call unregisterOnSharedPreferenceChangeListener, when you don't need it anymore, or you leave the Activity/Fragment

Blackbelt
  • 156,034
  • 29
  • 297
  • 305