For Store value in Sharedpreference
SharedPreferences myPrefs = PinActivity.this.getSharedPreferences("pinPref", MODE_WORLD_READABLE);
SharedPreferences.Editor prefsEditor = myPrefs.edit();
prefsEditor.putBoolean("pin_done", true);
prefsEditor.putString("pin_number", mStringPin);
prefsEditor.putString("pin_mail", mStringPinMail);
prefsEditor.commit();
For get value in Sharedpreference
SharedPreferences mSharedPreferences = getSharedPreferences("pinPref", 0);
mStringPin=mSharedPreferences.getString("pin_number", "");
mStringPinMail=mSharedPreferences.getString("pin_mail", "");
SharedPreferences myPrefs = PinActivity.this.getSharedPreferences("pinPref", MODE_WORLD_READABLE);
SharedPreferences.Editor prefsEditor = myPrefs.edit();
prefsEditor.putBoolean("pin_done", true);
prefsEditor.putString("pin_number", mStringPin);
prefsEditor.putString("pin_mail", mStringPinMail);
prefsEditor.commit();
For get value in Sharedpreference
SharedPreferences mSharedPreferences = getSharedPreferences("pinPref", 0);
mStringPin=mSharedPreferences.getString("pin_number", "");
mStringPinMail=mSharedPreferences.getString("pin_mail", "");
No comments:
Post a Comment