Save value to SharedPreferences : SHA « Security « Android






Save value to SharedPreferences

 

import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;

/** Collection of general purpose functions
 * @author johngraves
 *
 */
class Library {

  // ---------------------
  /** Update shared preferences from State */
  public static void savePreferences(Context context) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext());
    SharedPreferences.Editor editor = prefs.edit();
    editor.putBoolean("silentMode", true);
    editor.putString("language", "State.getLanguage()");
    editor.commit();
  }

}

   
  








Related examples in the same category

1.SHA-1 string
2.hmac Sha1 Digest
3.Sha1 hashes based on a given String
4.SHA1 Utils
5.Using SharedPreferences to store password
6.Using SharedPreferences
7.Drawing Shapes
8.Animated wallpaper draws a rotating wireframe shape with a choice of 2 shapes
9.Animation: shake
10.Get reference from SharedPreferences
11.Glutes shape
12.Reshaping Arabic Sentences and Text Utilities to deal with Arabic
13.Save SharedPreferences
14.SharedPreferences Set and get value
15.Compute the SHA-1 hash of the given byte array
16.compute SHA-1 Hash