【发布时间】:2019-07-04 07:21:43
【问题描述】:
我找到了一个应用的源代码,它使用外部浏览器(如 Chrome 或其他浏览器)打开网页。我想让它从应用程序内部访问这些页面,而不使用外部浏览器。我认为我应该以某种方式更改下面的代码,但我不知道如何。
private class MyWebviewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (Uri.parse(url).getHost().equals("http://dmc.teiion.gr")) {
//open url contents in webview
return false;
} else {
//here open external links in external browser or app
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(intent);
return true;
}
【问题讨论】:
标签: android browser android-webview android-browser