Skip to content

Using Java to set and get SharedPreferences even if you request it in onCreate

License

Notifications You must be signed in to change notification settings

Rampaigh/SharedPreferences

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 

Repository files navigation

Settings.java

SharedPreferences just got a whole lot better!

Usage

Settings settings;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    settings = new SettingsActivity(getApplicationContext());
}

Get Settings

settings.getBool("myBoolean");
settings.getFloat("myFloat");
settings.getInt("myInteger");
settings.getLong("myLong");
settings.getString("myString");
settings.getStringSet("myStringSet");

Set Settings

settings.setBool("myBoolean", true);
settings.setFloat("myFloat", 0.7564);
settings.setInt("myInteger", 132);
settings.setLong("myLong", 13234893487);
settings.setString("myString", "This is myString's value");
settings.setStringSet("myStringSet", null);

About

Using Java to set and get SharedPreferences even if you request it in onCreate

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages