Thursday, January 7, 2016

SharedPreferences in Android [ put string and get string ]

PUT
private SharedPreferences sharedPreferences;
sharedPreferences.edit()
        .putString("KEY_NAME", name)
        .apply();


GET
String NameURL= getPref("KEY_NAME", getContext());

public static String getPref(String key, Context context) {
    SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); 
  return preferences.getString(key, null);
 
 
 
Resources: 
https://medium.com/google-developers/sharedpreferences-is-your-answer-to-simple-storage-a7c8499ea8ff#.7eoyjrjgi

1 comment:

  1. How it works: Using Wickr Me you can make free calls and send free text messages using your webcam. Webcam: You can use your webcam for sending What Is Wickr Me

    ReplyDelete