File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ AptPreferences是基于面向对象设计的快速持久化框架,目的是为
10103 . 支持根据不同的用户区分持久化信息。
1111
1212### 简单例子
13+ ##### 定义javabean类
1314```
1415@AptPreferences
1516public class Settings {
@@ -18,15 +19,18 @@ public class Settings {
1819 // get、set方法
1920}
2021```
21-
22+ ##### 使用方式
2223```
24+ //初始化
25+ AptPreferencesManager.init(this, null);
2326// 保存信息
2427SettingsPreference.get().setLoginTime(System.currentTimeMillis());
2528SettingsPreference.get().set(new LoginUser("Wiki"));
2629// 获取信息
2730long loginTime = SettingsPreference.get().getLoginTime();
2831LoginUser loginUser = SettingsPreference.get().getLoginUser();
2932```
33+ 从上面的简单例子可以看到,我们需要做SharePreferences持久化,仅仅定义一个简单的javabean类(Settings)并添加注解即可,这个框架会根据javabean生成带有持久化功能的SettingsPreference类,通过这个类就可以非常简单去保持或者获取数据,大大降低了SharePreferences麻烦,也可以保持对象。
3034### 项目地址
3135https://github.com/joyrun/AptPreferences
3236### 一、配置项目
You can’t perform that action at this time.
0 commit comments