Popularity
3.0
Stable
Activity
0.0
Stable
129
7
28

Description

Simple Android SharedPreferences wrapper that will allow you to work easily and in a clean way with them.

Programming language: Java
License: GNU General Public License v3.0 only
Tags: Tools     Utility     Utilities     SharedPreferences    
Latest version: v1.3

Prefs alternatives and similar packages

Based on the "Tools" category.
Alternatively, view Prefs alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of Prefs or a related project?

Add another 'Tools' Package

README

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:

  Prefs.with(yourContext).readInt(YOUR_KEY_VALUE);
  Prefs.with(yourContext).readInt(YOUR_KEY_VALUE, defaultValue);

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

You can also specify a custom name for the preferences' name:

  Prefs.with(yourContext, "CUSTOM_NAME").readInt(YOUR_KEY_VALUE);

And force the re-instantiation of the Prefs instance:

  Prefs.with(yourContext, true).readInt(YOUR_KEY_VALUE);
  Prefs.with(yourContext, "CUSTOM_NAME", true).readInt(YOUR_KEY_VALUE);

You can also set and retrieve ordered String sets and unordered String sets.