SharedPreferences
method 1SharedPreferences mypref=this.getSharedPreferences("mypref",MODE_WORLD_READABLE);
SharedPreferences.Editor prefeditor=mypref.edit();
prefeditor.putString("slatti", slatti);
prefeditor.putString("slongi", slongi);
prefeditor.commit();
SharedPreferences mypref=this.getSharedPreferences("mypref",MODE_WORLD_READABLE);
String slatiii = mypref.getString("slatti", "nothing");
String slongiii = mypref.getString("slongi", "nothing");
method 2
SharedPreferences app_preferences =PreferenceManager.getDefaultSharedPreferences(ProfileloginActivity.this);
SharedPreferences.Editor editor = app_preferences.edit();
// String text = textBox.getText().toString();
editor.putString("key",username);
System.out.println("proffidddd"+username);
editor.commit();
SharedPreferences app_preferences = PreferenceManager.getDefaultSharedPreferences(this);
String username = app_preferences.getString("key", "null");
No comments:
Post a Comment