Search code examples
androidwebviewwebviewclient

WebView load from file and from web


I have a webview which will load from file or from the web. I set the WebViewClient to the webview and i override function onPageFinished(WebView view, String url).

Everytime the webview loads and finished, it will go to the function onPageFinished no matter it loads from the file or from the web.

My question is, can i skip the onPageFinished (or any other function) in WebViewClient if it loads from the FILE, and still goes there if it loads from the WEB?

Thanks for your answer :D


Solution

  • I think the best way is to control execution of the onPageFinished() yourself. Check inside the method if url started from "file:///..." or "http://..."