I have a webview in activity A and I’m navigating to activity B, so when I switch back to activity A I want to restore the webview, i.e., to reload its most recent URL and can go backward to view the history.
My problem is I reset the webview to null when activityA.onPause() gets called to avoid memory leak, but then I have problem restoring it when activityA.onResume() gets called since my design will have to create a new webview instance. That way even if I can restore the latest url I can’t restore the history.
Any advice would be greatly appreciated!
dirty one, you have to save your data on your onPause() method maybe in preferences, and retrieve the data from preference on your onResume() method and set your data to your webview.
Another way to solve this problem is to use activityForResult.