diff --git a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxHelper.java b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxHelper.java index db87c71c01..6ae9fb6a39 100644 --- a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxHelper.java +++ b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxHelper.java @@ -620,21 +620,21 @@ public class Cocos2dxHelper { SharedPreferences settings = sActivity.getSharedPreferences(Cocos2dxHelper.PREFS_NAME, 0); SharedPreferences.Editor editor = settings.edit(); editor.putBoolean(key, value); - editor.commit(); + editor.apply(); } public static void setIntegerForKey(String key, int value) { SharedPreferences settings = sActivity.getSharedPreferences(Cocos2dxHelper.PREFS_NAME, 0); SharedPreferences.Editor editor = settings.edit(); editor.putInt(key, value); - editor.commit(); + editor.apply(); } public static void setFloatForKey(String key, float value) { SharedPreferences settings = sActivity.getSharedPreferences(Cocos2dxHelper.PREFS_NAME, 0); SharedPreferences.Editor editor = settings.edit(); editor.putFloat(key, value); - editor.commit(); + editor.apply(); } public static void setDoubleForKey(String key, double value) { @@ -642,21 +642,21 @@ public class Cocos2dxHelper { SharedPreferences settings = sActivity.getSharedPreferences(Cocos2dxHelper.PREFS_NAME, 0); SharedPreferences.Editor editor = settings.edit(); editor.putFloat(key, (float)value); - editor.commit(); + editor.apply(); } public static void setStringForKey(String key, String value) { SharedPreferences settings = sActivity.getSharedPreferences(Cocos2dxHelper.PREFS_NAME, 0); SharedPreferences.Editor editor = settings.edit(); editor.putString(key, value); - editor.commit(); + editor.apply(); } public static void deleteValueForKey(String key) { SharedPreferences settings = sActivity.getSharedPreferences(Cocos2dxHelper.PREFS_NAME, 0); SharedPreferences.Editor editor = settings.edit(); editor.remove(key); - editor.commit(); + editor.apply(); } public static byte[] conversionEncoding(byte[] text, String fromCharset,String newCharset)