onSaveInstanceState Not writing data

1

I have two activities that I will call activityA and acitivityB.

In my activityA I have the following method.

    @Override
    protected void onSaveInstanceState(Bundle bundle) {
       bundle.putString("ACTIVITY", "Dados que precisando ser salvos!");
       super.onSaveInstanceState(bundle);
    }

When I go to ActivityB this method above is called. But when I go back to the ActivityA in the onCreate () method; My bundle is null.

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    if (savedInstanceState != null){
        String teste = savedInstanceState.getString("ACTIVITY");
  }
}

Can anyone tell me why?

    
asked by anonymous 11.09.2017 / 01:12

0 answers