Tob*_*ias 10 performance android preferences
在我当前的Android应用程序中,我有几个存储在SharedPreferences中的设置和一个处理它们访问权限的对象.我现在想知道缓存这些值是否有意义,或者是否更多地访问它们,如:
public final boolean isxxxEnabled() {
return preferences.getBoolean("xxx", false);
}
Run Code Online (Sandbox Code Playgroud)
代替
public final boolean isxxxEnabled() {
// check if value changed
// if not, check if value is cached
// decide whether to return cached or new
// cache value
return
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1884 次 |
| 最近记录: |