Android : webview shouldOverrideUrlLoading doesn't work as expected?

on Wednesday, April 1, 2015


I have a webview that loads a real URL something like https://example.com


I would like to open some links according to a pattern in a second webview.


I have the following code:



public boolean shouldOverrideUrlLoading(WebView view, String url) {
// Handle external url
boolean openInNew = manageUrl (url);
Log.i("openurl", url + " : " + openInNew);
if (openInNew) {
this.callBack.openWebView2 (url);
return true;
} else {
return false;
}
}


The second webview shows correctly the external url I want to load.


The problem I found is about what happens with the original webview, it is also redirected to an empty blank page (with a loading icon).


Is possible to keep the first webview in the original page? I thought that with shouldOverrideUrlLoading should be enough.


Maybe I forgot something, any help would be appreciate.


Thanks a lot.


0 comments:

Post a Comment