0
在我的应用程序中,我想将URL限制为多个域。例如,如果我想将其限制在一个域,这个工程:Android:将webview限制为多个网址
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if(Uri.parse(url).getHost().endsWith("stackoverflow.com")) {
return false;
}
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
view.getContext().startActivity(intent);
return true;
}
那么,如何改变这一行:
if(Uri.parse(url).getHost().endsWith("stackoverflow.com"))
白名单多个URL,如:
stackoverflow.com
stackexchange.com
google.com
我想添加的所有网址ArrayList和使用'如果(urlList.contains(Uri.parse(URL).getHost())){返回false}其他{//打开页面}' –