I have two different activities, in the first one I enter some info into some EditTexts, I then go to the second activity, but when I return, the text that was on EditTexts in the first activity are gone.
Here is the OnCreate() for the first activity:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.act_frm_recetas);
txtClient = (EditText) findViewById(R.id.txtNombreCliente);
if(savedInstanceState != null){
String client = savedInstanceState.getString("Client");
txtClient.setText(client);
}
}
I'm using the onSaveInstanceState method to save the info
@Override
public void onSaveInstanceState(Bundle savedInstanceState) {
String x = txtClient.getText().toString();
savedInstanceState.putString("Client", x);
super.onSaveInstanceState(savedInstanceState);
}
When doing a debug, I can see the savedInstanceState Bundle has indeed been filled in the onSaveInstanceState method, but in the OnCreate in shows null.
Maybe I have to add something in the second activity? I currently don't have anything in there other than a button that takes me back to the first activity.