my main activity contains a webview, and i have a notification which says the program is running and when the user clicks on the notification the main activity opens. and my problem is when the user clicks on the notification my main activity starts from oncreate method and the url opens again BUT i DON'T want to reopen the URL.
Asked
Active
Viewed 1,704 times
-2
-
Post your code that your have tried. – Spring Breaker Jan 18 '14 at 11:58
1 Answers
0
First move the code that load the URL from onCreate
to onResume
If url is the page you want to open
public void onResume(...) {
// ...
String url = "...";
if (!url.equals(webView.getUrl())) {
webView.loadUrl(url);
}
}
Note that if your app has been in the background for a while, Android will kill it, and the webview will reload - nothing you can do about it.

Greg Ennis
- 14,917
- 2
- 69
- 74