Question

Just a simple question in onSharedPreferenceChanged you can do something based on if a change is made in a specific key which would look like, if (key.equals(Theme_Preference)). I want to do the same thing but instead of just a key I want it to be for a specific entryValue in that key. Hope this makes sense.

Was it helpful?

Solution

So..how about something like...

public void onSharedPreferenceChanged(SharedPreferences prefs, String key) 
    {
        if (key.equals(Theme_Preference) && prefs.getString(key, "default value").equals("the value you want to respond to"))
        {
            // do your stuff
        }

    }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top