I try to execute some code after a link is clicked in a webview. For normal links like http:// I managed this using the shouldOverrideUrlLoading method and view.loadUrl(url);
But with links starting with market:// to redirect to the GooglePlay App, this doesn't work. loadURL("market://") throws a URL not found error.
How can I detect if a market:// link is clicked in a webview ?
My Code:
wvinfo.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (url.startsWith("http")) {
view.loadUrl(url); // WORKS
return true;
} else if (url.startsWith("market:")){
<DO SOMETHING SPECIAL>
view.loadUrl(url); // DOESN'T WORK
return true;
}
}
});