How to save current results / data before going to child activity so that I can restore the data when will press system up button at child activity?
Asked
Active
Viewed 76 times
2 Answers
0
use onPause
and onResume
method of the activity
More info in the training guides
Your activities data isnt lost when it goes deeper in the hierarchy unless you finish the activity.
Another solution which is better is use startActivityForResult
That is explained in detail here

Shubhank
- 21,721
- 8
- 65
- 83
-
I also tried startActivityForResult.. But, I noticed that onActivityResult is not be called when pressing up button at child activity. – Mosiur Mar 07 '14 at 08:28
-
then ? please explain in detail – Shubhank Mar 07 '14 at 08:29
0
You could use saveInstanceState
for saving the data needed later when reopening the activity.
Check this answer: https://stackoverflow.com/a/151940/1101730
EDIT: It seem like this is usable when the activity is killed, which might not be your case.