I have 2 activities A and B.
- I call activity B from activity A using startActivity(B);
- I do some operations in B and call back activity A using startActivity(A);
I have noticed that instance variables in class A are cleared (reinitialized). Is using onSaveInstanceState(Bundle) a correct way to save these variables before A gets stopped?
In my onCreate(Bundle savedInstanceState) method of class A, I try to retrieve the data previously saved by onSaveInstanceState(Bundle). However the variable savedInstanceState is always null and I can’t retrieve any data.
If you want to return to your previous activity, you must call finish() on activity B, and then intercept it in activity A with onActivityResult().
Is that what you tried to accomplish?