|
1 | 1 | # FastSave-Android
|
2 |
| -An Android library for fast and easy access to Android Shared preferences. |
| 2 | + |
| 3 | +FastSave is An Android library for fast and easy access to Android Shared preferences. |
| 4 | +It allows you to save any type or list in the sharedpreferences and retrieve it in convenient way. |
| 5 | + |
| 6 | +# Installation |
| 7 | + |
| 8 | +<b>Add FastSave-Android to your app level build.gradle dependency</b> |
| 9 | + |
| 10 | +``` |
| 11 | +allprojects { |
| 12 | + repositories { |
| 13 | + ... |
| 14 | + maven { url 'https://jitpack.io' } |
| 15 | + } |
| 16 | +} |
| 17 | +
|
| 18 | +dependencies { |
| 19 | + implementation 'com.github.yehiahd:FastSave-Android:1.0.0' |
| 20 | +} |
| 21 | +
|
| 22 | +``` |
| 23 | + |
| 24 | +You have to initialize the FastSave library inside your application class : |
| 25 | + |
| 26 | +```` |
| 27 | +public class MyApplication extends Application { |
| 28 | + @Override |
| 29 | + public void onCreate() { |
| 30 | + super.onCreate(); |
| 31 | + FastSave.init(getApplicationContext()); |
| 32 | + } |
| 33 | +} |
| 34 | +
|
| 35 | +```` |
| 36 | + |
| 37 | +<b>Usage</b> |
| 38 | + |
| 39 | +```` |
| 40 | +FastSave.getInstance().saveInt(key,value); // For saving Integer value |
| 41 | +FastSave.getInstance().getInt(key); // For Getting Integer value |
| 42 | +
|
| 43 | +FastSave.getInstance().saveFloat(key,value); // For saving Float value |
| 44 | +FastSave.getInstance().getFloat(key); // For Getting Float value |
| 45 | +
|
| 46 | +// And so on for other types. |
| 47 | +
|
| 48 | +//For Objects and Lists of Objects |
| 49 | +
|
| 50 | +FastSave.getInstance().saveObject(key,customObject); // For Saving Custom Object |
| 51 | +FastSave.getInstance().getObject(key,classType); // For Getting Custom Object |
| 52 | +
|
| 53 | +//Example on getting customObject |
| 54 | +FastSave.getInstance().getObject(key,Person.class); // assuming your custom class called Person |
| 55 | +
|
| 56 | +FastSave.getInstance().saveObjectList(key,listOfCustomObjects); // For Saving Custom Objects List |
| 57 | +FastSave.getInstance().getObjectList(key,classType); // For Getting Custom Objects List |
| 58 | +
|
| 59 | +```` |
0 commit comments