문제

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.

도움이 되었습니까?

해결책

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
        }

    }
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top