-
Notifications
You must be signed in to change notification settings - Fork 0
/
UaoanMMKV.java
59 lines (55 loc) · 1.51 KB
/
UaoanMMKV.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package com.uaoanlao.uaoanlibrary;
import android.content.Context;
public class UaoanMMKV {
public static com.tencent.mmkv.MMKV mm;
//初始化
public UaoanMMKV init(Context context){
com.tencent.mmkv.MMKV.initialize(context);
mm= com.tencent.mmkv.MMKV.defaultMMKV();
return this;
}
//写入数据到mmkv
public void setMMKV(String nr,String nr1){
mm.encode(nr,nr1);
}
//写入数据到mmkv
public void setMMKV(String nr,int nr1){
mm.encode(nr,nr1);
}
//写入数据到mmkv
public void setMMKV(String nr,boolean nr1){
mm.encode(nr,nr1);
}
//写入数据到mmkv
public void setMMKV(String nr,float nr1){
mm.encode(nr,nr1);
}
//写入数据到mmkv
public void setMMKV(String nr,Long nr1){
mm.encode(nr,nr1);
}
//删除mmkv指定数据
public void setDeleMMKV(String nr){
mm.removeValueForKey(nr);
}
//判断mmkv某条数据是否存在
public boolean isContainsMMKVKey(String nr){
return mm.containsKey(nr);
}
//获取mmkv的某条数据内容
public String getMMKVString(String nr){
return mm.decodeString(nr);
}
public int getMMKVInt(String nr){
return mm.decodeInt(nr);
}
public boolean getMMKVBoolean(String nr){
return mm.decodeBool(nr);
}
public Long getMMKVLong(String nr){
return mm.decodeLong(nr);
}
public float getMMKVFloat(String nr){
return mm.decodeLong(nr);
}
}