I am trying to save a string 'reftext' to the first element of an array 'savedabc[]' using SharedPreferences. My variables are declared as below.
private EditText reftext;
private static SharedPreferences savedabc;
private static EditText[] savedabc;
Here is the 'Save' method:
public void onSaveClick(View view) {
SharedPreferences savedabc = getSharedPreferences("SavedABC", Context.MODE_PRIVATE);
SharedPreferences.Editor editor = savedabc.edit();
editor.putString(savedabc[0], reftext);
editor.commit();
}
However, this gives me the following error: "The method putString(String, String) in the type SharedPreferences.Editor is not applicable for the arguments (EditText, EditText)".
Could anyone help with this please?
Many thanks.