diff --git a/app/src/main/java/com/example/app/MyWebViewClient.java b/app/src/main/java/com/example/app/MyWebViewClient.java index 6b528e8..5fdb5a8 100755 --- a/app/src/main/java/com/example/app/MyWebViewClient.java +++ b/app/src/main/java/com/example/app/MyWebViewClient.java @@ -12,7 +12,8 @@ class MyWebViewClient extends WebViewClient { @SuppressWarnings("deprecation") @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { - if (Objects.requireNonNull(Uri.parse(url).getHost()).endsWith("example.com")) { + Uri uri = Uri.parse(url); + if (uri.getHost() != null && uri.getHost().contains("example.com")) { return false; } @@ -20,4 +21,4 @@ class MyWebViewClient extends WebViewClient { view.getContext().startActivity(intent); return true; } -} \ No newline at end of file +}