Commit f6d8b0ab authored by linfeng's avatar linfeng

bug修改

parent 081602a5
......@@ -19,7 +19,11 @@ public class AppCookie {
private static SharedPreferences getPreference() {
if (preferences == null) {
preferences = weakReference.get().getSharedPreferences(COOKIE_FILE, Context.MODE_PRIVATE);
synchronized (AppCookie.class) {
if (null == preferences) {
preferences = weakReference.get().getSharedPreferences(COOKIE_FILE, Context.MODE_PRIVATE);
}
}
}
return preferences;
}
......
......@@ -19,7 +19,11 @@ public class LocationRecord {
private static SharedPreferences getPreference(Context context) {
if (preferences == null) {
preferences = context.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE);
synchronized (LocationRecord.class) {
if (null == preferences) {
preferences = context.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE);
}
}
}
return preferences;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment