I have two actions in an Android application, each has a button that jumps to another action (method startActivity()). In the second step, I have an edit text (URL address bar) and a web view.
So, when I click activity1 button to start activity2, I get activity2 with a web view. Then I type cnn.com(for example) in the address bar, and my webview displays the website cnn.com. After that, I click the button to go from activity2 to activity1. If I click on activity1 button again, I started activity2. But activity2 has just been created, I mean that the edit text and web view are empty.
I want: if I return from activity1 to activity2, I want Activity2 to keep the last state: the edit text should contain cnn.comand the webview should show the CNN website. Therefore, I need not to leave Activity2 before starting activity1, but something like just hiding and starting activity2, so if I return to it again, I will get its last state. (Like, for example, when I press the home button.) How can I achieve this?
source
share