The CCUserDefault and SharedPreferences in Android are used to store simple data.
[Cpp]
// Obtain the bool Value
Bool getBoolForKey (const char * pKey, bool defaultValue = false );
// Obtain the integer value
Int getIntegerForKey (const char * pKey, int defaultValue = 0 );
// Obtain the floating point value
Float getFloatForKey (const char * pKey, float defaultValue = 0.0f );
// Obtain double-precision floating point values
Double getDoubleForKey (const char * pKey, double defaultValue = 0.0 );
// Obtain the string
Std: string getStringForKey (const char * pKey, const std: string & defaultValue = "");
// Set the Boolean Value
Void setBoolForKey (const char * pKey, bool value );
// Set the integer value
Void setIntegerForKey (const char * pKey, int value );
// Set the floating point value
Void setFloatForKey (const char * pKey, float value );
// Double-precision floating point value
Void setDoubleForKey (const char * pKey, double value );
// Set the string value
Void setStringForKey (const char * pKey, const std: string & value );
// Obtain the bool Value
Bool getBoolForKey (const char * pKey, bool defaultValue = false );
// Obtain the integer value
Int getIntegerForKey (const char * pKey, int defaultValue = 0 );
// Obtain the floating point value
Float getFloatForKey (const char * pKey, float defaultValue = 0.0f );
// Obtain double-precision floating point values
Double getDoubleForKey (const char * pKey, double defaultValue = 0.0 );
// Obtain the string
Std: string getStringForKey (const char * pKey, const std: string & defaultValue = "");
// Set the Boolean Value
Void setBoolForKey (const char * pKey, bool value );
// Set the integer value
Void setIntegerForKey (const char * pKey, int value );
// Set the floating point value
Void setFloatForKey (const char * pKey, float value );
// Double-precision floating point value
Void setDoubleForKey (const char * pKey, double value );
// Set the string value
Void setStringForKey (const char * pKey, const std: string & value );
Usage:
[Cpp]
CCUserDefault: sharedUserDefault ()-> setStringForKey ("UserName", "henn ");
CCUserDefault: sharedUserDefault ()-> setStringForKey ("UserName", "henn ");