Prefs

by GrenderG

GrenderG / Prefs

Simple Android SharedPreferences wrapper.

125 Stars 21 Forks Last release: over 3 years ago (1.3) GNU General Public License v3.0 34 Commits 3 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

ko-fi

Prefs

Android Arsenal

Simple Android

SharedPreferences
wrapper.

Repository

Add this in your root

build.gradle
file (not your module
build.gradle
file):
allprojects {
    repositories {
        ...
        maven { url "https://jitpack.io" }
    }
}

Dependency

Add this to your module's

build.gradle
file (make sure the version matches the JitPack badge above):
dependencies {
    ...
    compile 'com.github.GrenderG:Prefs:1.3'
}

Usage

This is the basic usage, you can read values (specifying a default value or not) and write values like so: ``` java Prefs.with(yourContext).readInt(YOURKEYVALUE); Prefs.with(yourContext).readInt(YOURKEYVALUE, defaultValue);

Prefs.with(yourContext).writeInt(YOURKEYVALUE, valueToStore);

You can also specify a custom name for the preferences' name:
java Prefs.with(yourContext, "CUSTOMNAME").readInt(YOURKEYVALUE);
And force the re-instantiation of the Prefs instance:
java Prefs.with(yourContext, true).readInt(YOUR
KEYVALUE); Prefs.with(yourContext, "CUSTOMNAME", true).readInt(YOURKEYVALUE); ``
You can also set and retrieve
ordered String sets
and
unordered String sets`.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.