Skip to content

Commit ab24267

Browse files
authored
Update README.md
1 parent 4cea541 commit ab24267

File tree

1 file changed

+48
-1
lines changed

1 file changed

+48
-1
lines changed

README.md

+48-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,48 @@
1-
# Guru
1+
# Guru
2+
3+
Guru is a handy and powerful library to work with key-value storages in Android
4+
<p align="center">
5+
<img width="500" height="170" src="https://raw.githubusercontent.com/squti/Guru/master/static/guru_logo.png">
6+
</p>
7+
8+
9+
This library is an efficient and super easy way to use Android Shared Preferences without complexity and supports all of it functionalities.
10+
11+
12+
### Usage
13+
There is no need to initialize or config Guru. Just call it methods directly anywhere.
14+
15+
```java
16+
// To save String
17+
Guru.putString("KEY", "value");
18+
19+
```
20+
21+
```java
22+
// To get String
23+
// default value returns if the key doesn't exist
24+
Guru.getString("KEY", "default value");
25+
26+
```
27+
That's it !
28+
29+
This example shows how to put and get a string. You can use other methods to work with other data types.
30+
### Configuration
31+
The default Preferences file name is `APPLICATION_ID.Default_App_Preference` <br/>
32+
(example: com.github.squti.guru.Default_App_Preference)<br/>
33+
And the default Preferences mode is `MODE_PRIVATE`
34+
35+
But you can change them using `GuruConfig`, in your Application class in the `#onCreate()` method.
36+
```java
37+
@Override
38+
public void onCreate() {
39+
super.onCreate();
40+
GuruConfig.initDefault(new GuruConfig.Builder()
41+
.setFileName("guru_preference")
42+
.setMode(Context.MODE_PRIVATE)
43+
.build());
44+
//....
45+
}
46+
```
47+
_Note: You don't need to define `GuruConfig` and the library will apply
48+
default configuration._

0 commit comments

Comments
 (0)