-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathAppPrefes.java
More file actions
executable file
·65 lines (56 loc) · 1.31 KB
/
AppPrefes.java
File metadata and controls
executable file
·65 lines (56 loc) · 1.31 KB
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
60
61
62
63
64
65
/**
*
*/
package com.luttu;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
/**
* @author android
*
*/
public class AppPrefes {
private SharedPreferences appSharedPrefs;
private Editor prefsEditor;
public AppPrefes(Context context, String Preferncename) {
this.appSharedPrefs = context.getSharedPreferences(Preferncename,
Activity.MODE_PRIVATE);
this.prefsEditor = appSharedPrefs.edit();
}
/****
*
* getdata() get the value from the preference
*
* */
public String getData(String key) {
return appSharedPrefs.getString(key, "");
}
/****
*
* SaveData() save the value to the preference
*
* */
public void SaveData(String Tag, String text) {
prefsEditor.putString(Tag, text);
prefsEditor.commit();
}
/****
*
* IsTrue() get the boolean value from the preference
*
* */
public boolean IsTrue(String key, boolean defValue) {
boolean res = appSharedPrefs.getBoolean(key, defValue);
return res;
}
/****
*
* SaveBoolean() save the boolean value to the preference
*
* */
public void SaveBoolean(String key, boolean boValue) {
prefsEditor.putBoolean(key, boValue);
prefsEditor.commit();
}
}