Browse Source

1.将CurrentAppSharedPreferencesUtils中的apply修改为commit防止应用退出时,文件写入失败。

20241218TB223FC(测试jar包)
wangwanlei 4 months ago
parent
commit
9568915a41

+ 3
- 3
app/src/main/java/com/xhly/manageapp/utils/CurrentAppSharedPreferencesUtils.java View File

@@ -60,7 +60,7 @@ public class CurrentAppSharedPreferencesUtils {
60 60
             editor.putLong(key, (Long) object);
61 61
         }
62 62
 
63
-        editor.apply();
63
+        editor.commit();
64 64
         return false;
65 65
     }
66 66
 
@@ -103,7 +103,7 @@ public class CurrentAppSharedPreferencesUtils {
103 103
         SharedPreferences.Editor edit = preferences.edit();
104 104
         if (edit != null) {
105 105
             edit.putString(key, strJson);
106
-            edit.apply();
106
+            edit.commit();
107 107
         }
108 108
     }
109 109
 
@@ -111,7 +111,7 @@ public class CurrentAppSharedPreferencesUtils {
111 111
         SharedPreferences.Editor edit = preferences.edit();
112 112
         if (edit != null) {
113 113
             edit.putString(key, "");
114
-            edit.apply();
114
+            edit.commit();
115 115
         }
116 116
     }
117 117
 

Loading…
Cancel
Save