com.badlogic.gdx
Interface Preferences


public interface Preferences

A Preference instance is a hash map holding different values. It is stored alongside your application (SharedPreferences on Android, LocalStorage on GWT, on the desktop a Java Preferences file in a ".prefs" directory will be created, and on iOS an NSMutableDictionary will be written to the given file). CAUTION: On the desktop platform, all libgdx applications share the same ".prefs" directory. To avoid collisions use specific names like "com.myname.game1.settings" instead of "settings"

Changes to a preferences instance will be cached in memory until flush() is invoked.

Use Application.getPreferences(String) to look up a specific preferences instance. Note that on several backends the preferences name will be used as the filename, so make sure the name is valid for a filename.

Author:
mzechner

Method Summary
 void clear()
           
 boolean contains(String key)
           
 void flush()
          Makes sure the preferences are persisted.
 Map<String,?> get()
          Returns a read only Map with all the key, objects of the preferences.
 boolean getBoolean(String key)
           
 boolean getBoolean(String key, boolean defValue)
           
 float getFloat(String key)
           
 float getFloat(String key, float defValue)
           
 int getInteger(String key)
           
 int getInteger(String key, int defValue)
           
 long getLong(String key)
           
 long getLong(String key, long defValue)
           
 String getString(String key)
           
 String getString(String key, String defValue)
           
 void put(Map<String,?> vals)
           
 void putBoolean(String key, boolean val)
           
 void putFloat(String key, float val)
           
 void putInteger(String key, int val)
           
 void putLong(String key, long val)
           
 void putString(String key, String val)
           
 void remove(String key)
           
 

Method Detail

putBoolean

void putBoolean(String key,
                boolean val)

putInteger

void putInteger(String key,
                int val)

putLong

void putLong(String key,
             long val)

putFloat

void putFloat(String key,
              float val)

putString

void putString(String key,
               String val)

put

void put(Map<String,?> vals)

getBoolean

boolean getBoolean(String key)

getInteger

int getInteger(String key)

getLong

long getLong(String key)

getFloat

float getFloat(String key)

getString

String getString(String key)

getBoolean

boolean getBoolean(String key,
                   boolean defValue)

getInteger

int getInteger(String key,
               int defValue)

getLong

long getLong(String key,
             long defValue)

getFloat

float getFloat(String key,
               float defValue)

getString

String getString(String key,
                 String defValue)

get

Map<String,?> get()
Returns a read only Map with all the key, objects of the preferences.


contains

boolean contains(String key)

clear

void clear()

remove

void remove(String key)

flush

void flush()
Makes sure the preferences are persisted.



Copyright © 2014. All Rights Reserved.