views:

109

answers:

3

Hi,

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!

A: 

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

Konstantin Burov
A: 

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

Jorgesys
A: 

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

Profete162