changus
changus

Reputation: 763

Android WebView Reload when the app loads

I am writing an android application that has a webview. On the first load it works fine, I am able to browse and drill down to pages. My expected behavior is that if I leave the application and come back, it should redirect to the page that I have it set to call in the webView.loadUrl("[page i set here]") but it seems to load the page that I was last on when I last used it.

How can I kill the app in the onStop() method? Or, am I supposed to do something else in order for it to restart the application on every load.

Thanks in advance!

Upvotes: 1

Views: 1696

Answers (3)

Waza_Be
Waza_Be

Reputation: 39577

Both of you are right, but for better understanding, I suggest changus to understand this diagram:

http://www.androidside.com/data/geditor/0812/1062731775_4e7c4d93_android+activity+life+cycle.jpg

as well as this page:

http://developer.android.com/guide/topics/fundamentals.html#lcycles

Upvotes: 0

Jorgesys
Jorgesys

Reputation: 126573

you will ensure the end of your app with

public void finish() {
        super.finish();
}

so the next time your webview will load the specified page in your code again

Upvotes: 1

Konstantin Burov
Konstantin Burov

Reputation: 69238

I'm agree with Mayra, but if you really need this, try to put the logic to the onResume method.

Upvotes: 0

Related Questions