Reputation: 3
I'm junior of android developer. (super beginner T_T) I'm having trouble with Android Webview.
I am making a Hybrid app. - when touch the app icon, it is linked to the webview(webview.loadurl(url)) directly.
but unfourtunately, it works
Index page(login.jsp) -> A page -> B page -> Home button -> re-click the app or ~ -> Index page -> back key -> B page... It really strange.. \T_T (back key -> B page :: Session didnt fired. may be keeped.)
I searched a lot about these problems. Many people answered - Using Cookies and keep the session. but it also didn't work for me.
I know I didnt explain current problem well and show the code to you. but I really really need help . So please give me any hint. Do I have to save the url adress which I searched last.?
Upvotes: 0
Views: 1424
Reputation: 27994
Just to make sure we're talking about the same thing: when you say "home button," you mean the Android home button, not something on the web page, right?
When you press the home button, your activity is stopped; and it is restarted when the user returns to your app. The activity does not necessarily get destroyed and recreated, but it could, in which case the state is lost (except for state that the activity automatically saves).
I don't know about webview specifically, but if your activity is losing important state, such as the URL of the B page, you can save and restore it by overriding onSaveInstanceState() and onRestoreInstanceState().
Upvotes: 1