Created
April 7, 2012 15:13
-
-
Save tateisu/2329613 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public SharedPreferences getSharedPreferences(String name, int mode) { | |
SharedPreferencesImpl sp; | |
synchronized (sSharedPrefs) { | |
sp = sSharedPrefs.get(name); | |
if (sp == null) { | |
File prefsFile = getSharedPrefsFile(name); | |
sp = new SharedPreferencesImpl(prefsFile, mode); | |
sSharedPrefs.put(name, sp); | |
return sp; | |
} | |
} | |
if ((mode & Context.MODE_MULTI_PROCESS) != 0 || | |
getApplicationInfo().targetSdkVersion < android.os.Build.VERSION_CODES.HONEYCOMB) { | |
// If somebody else (some other process) changed the prefs | |
// file behind our back, we reload it. This has been the | |
// historical (if undocumented) behavior. | |
sp.startReloadIfChangedUnexpectedly(); | |
} | |
return sp; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment