android - how to store multiple key value pairs in shared preferences -


I have a username and password field. I want to store them using share sharing preferences. Share .

Shared PRF = getApplicationContext (). GetSharedPreferences ("Shared", Context.MODE_PRIVATE); String Secret = Geometric ("imei_num", tap); If (null == secretKey) {editor.putString ("imei_num", imei_of_the_device); Editor.putString (. "Pin", pinPrimary.getText () toString ()); Editor.commit (); Store

in the shared pages:

 < Code> shared spreads prefaces = GetSharedPreferences ("shared", Context.MODE_PRIVATE); Prefs.edit (). PutString ("imei_num", imei_of_the_device) .put string ("pin", pinprintary.gate text). ToString ()). Committed ();  

and retrieve this way:

  string imei = prefs.getString ("imei_num", "default value"); String pass = prefs.getString ("pin", "default value");  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -