I have my main.xml
layout. From here, the user fills in information, and is to click a button that should bring them to another describe.xml
layout.
The question is: how do I get it so that you can press a button on main.xml
to open up describe.xml
, then when you hit a button on the describe.xml
, you return to main.xml
without any info开发者_开发百科rmation previously inputted into main.xml
lost?
Thank you in advanced.
There are three ways to do this
1) When you start Activity describe Activity
don't finish() main Activity
so that when you finish describe Activity
main Activity will be resume without and lost of data
2) If you want to get data from describe Activity to main Activity you can start describe Activity by calling startActivityForResult
and you can get result from describe Activity to main Activity
3) You can also save data to preference file
Just store your information in a SharedPreference or a file or some static field in the override onPaused() method, and read out and fill information in the onResume() method.
精彩评论