Commit df8bc0c784d8b031464a5b43c35691f6e0b53a6d
1 parent
53be7047
1 修改sp名
Showing
1 changed file
with
2 additions
and
5 deletions
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/utils/MySpHelper.java
| @@ -14,6 +14,7 @@ public class MySpHelper { | @@ -14,6 +14,7 @@ public class MySpHelper { | ||
| 14 | private static final String TAG = "MySpHelper"; | 14 | private static final String TAG = "MySpHelper"; |
| 15 | private static MySpHelper sharedPreferencesHelper = null; | 15 | private static MySpHelper sharedPreferencesHelper = null; |
| 16 | private static int SP_MODE;//指定模式 | 16 | private static int SP_MODE;//指定模式 |
| 17 | + private static final String SP_NAME = "pedometer_config"; | ||
| 17 | 18 | ||
| 18 | //单例模式,把Context传进去 | 19 | //单例模式,把Context传进去 |
| 19 | public static MySpHelper getInstance(Context context, int MODE) { | 20 | public static MySpHelper getInstance(Context context, int MODE) { |
| @@ -135,11 +136,7 @@ public class MySpHelper { | @@ -135,11 +136,7 @@ public class MySpHelper { | ||
| 135 | 136 | ||
| 136 | //获得SharedPreferences对象 | 137 | //获得SharedPreferences对象 |
| 137 | private SharedPreferences getSP() { | 138 | private SharedPreferences getSP() { |
| 138 | - return context.getSharedPreferences("sp", SP_MODE); | ||
| 139 | - } | ||
| 140 | - | ||
| 141 | - private SharedPreferences getSP(String name) { | ||
| 142 | - return context.getSharedPreferences(name, SP_MODE); | 139 | + return context.getSharedPreferences(SP_NAME, SP_MODE); |
| 143 | } | 140 | } |
| 144 | 141 | ||
| 145 | public void removeKey(String key) { | 142 | public void removeKey(String key) { |