- Code: Select all
public class Settings extends Activity implements OnClickListener{
Button b3, b4;
public static final String PREFS_SETTINGS = "mySharedPreferences";
--Ommitted --
@Override
public void onClick(View v) {
int mode = Activity.MODE_PRIVATE;
//SharedPreferences mySharedPreferences = getSharedPreferences(PREFS_SETTINGS,mode);
//SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
//Intent data = new Intent();
EditText na1 = (EditText) findViewById(R.id.txt_Person1);
na1.setText(PREFS_SETTINGS, null);
EditText na2 = (EditText) findViewById(R.id.txt_Person2);
na2.setText(PREFS_SETTINGS, null);
showDialog(0);
}
});
}
When I typed "Tim" in the textbox and select the "Save" button, the text in the textbox is chnaged to "mySharedPreferences". Can I know where my mistake is and how to correct it.
and
May I ask how can I save my data using the codes below.
- Code: Select all
int mode = Activity.MODE_PRIVATE;
//SharedPreferences mySharedPreferences = getSharedPreferences(PREFS_SETTINGS,mode);
//SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
I'm creating a xml files after saving. But I don't how to.
Thank you. Help greatly appreciate.


