i have two edittext i want to save data in edittext until i have not change it how to made it . i try some thing like this but data not save.
e1 = (EditText)findViewById(R.id.editText);
e2 = (EditText)findViewById(R.id.editText2);
b1 = (Button)findViewById(R.id.button3);
sharedpreferences = getSharedPreferences(MyPREFERENCES, Context.MODE_PRIVATE);
b1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String homewifi = e1.getText().toString();
String officewifi = e2.getText().toString();
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putString(HOMEWIFI, homewifi);
editor.putString(OFFICEWIFI, officewifi);
editor.commit();
Toast.makeText(MainActivity.this,"Thanks",Toast.LENGTH_SHORT).show();
}
});
when activity open again data not show in edittext.