我在这里搜索,但几乎所有的问题都是相反的..现在我问; 我有一个适用于android studio的webview应用程序。它通过我的webview应用程序打开位于HTML页面中的所有URL。我希望它打开应用程序中的网址,而不是webview
但我想补充一些例外。例如,我想在默认的Google Play应用中使用https://play.google.com ....但不是我的webview应用。
摘要:应用程序的WebView必须打开通过应用程序本身的一些正常的网址,但通过本地其他应用程序的一些特殊的URL ...
我webviewclient代码是这样;
public class MyAppWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (Uri.parse(url).getHost().endsWith("http://play.google.com")) {
return false;
}
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
view.getContext().startActivity(intent);
return true;
}
}
调试过你的代码了吗?我猜“如果”的说法是错误的? – Devrim