0

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?

Mosiur
  • 1,342
  • 13
  • 16

2 Answers2

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
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.

Community
  • 1
  • 1
Micer
  • 8,731
  • 3
  • 79
  • 73