Save Value in SharedPreferences
In Android Save Value in key pair format we use SharedPreferences.
SharedPreferences myPrefs = getSharedPreferences("TAG", MODE_PRIVATE);
SharedPreferences.Editor myEditor = myPrefs.edit();
SharedPreferences.Editor myEditor = myPrefs.edit();
save value
myEditor.putString("name", abc); // key pair
myEditor.commit();
myEditor.commit();
Save Boolean Value
myEditor.putBoolean("key", abc); // key pair
myEditor.commit();
Get Boolean Value
boolean status= myEditor.getBoolean(key, false);
Get Save value
String name = myPrefs.getString("name", "");
No comments :
Post a Comment