开发者

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 su开发者_C百科pposed to do something else in order for it to restart the application on every load.

Thanks in advance!


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


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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜