An alternative to Android's webview

Redwarp picture Redwarp · Sep 30, 2011 · Viewed 10k times · Source

Does anyone knows an alternative to Android's webview component ? For some reasons, it's functionality's are insufficient for me : I need to be able to catch every single request to some url, when i'm browsing a wml page (wap). Anyway, I need to be able to do stuff that Android's webview is not made for. I thought "hey, let's play with the source code, I'm pretty sure that webviews are using apache.org librairies to access internet". Oh boy was I mistaken. Webviews use native code, and that's where I'm stuck.

So I was wondering if anyone knew of another web browser view, in pure java, that would be open source and nice. It's not a problem if it's slow, i'm displaying some basic wap pages...

Thanks in advance.

Answer

Shahul3D picture Shahul3D · Jun 26, 2012

You can extend WebView's functionality by using setWebViewClient & setWebChromeClient.

WebView.setWebViewClient(new MyWebViewClient());
WebView.setWebChromeClient(new WebChromeClient() {..}

You can handle each and every request sent/received from the WebView by overriding the below methods:

public boolean shouldOverrideUrlLoading(WebView view, String url) {..}
public void onPageStarted(WebView view, String url, Bitmap favicon) {..}
public void onPageFinished(WebView view, String url) {..}