diff --git a/app/src/main/java/com/example/app/MyWebViewClient.java b/app/src/main/java/com/example/app/MyWebViewClient.java index 2087cf1..fd88362 100755 --- a/app/src/main/java/com/example/app/MyWebViewClient.java +++ b/app/src/main/java/com/example/app/MyWebViewClient.java @@ -9,7 +9,8 @@ public class MyWebViewClient extends WebViewClient { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { - if (Uri.parse(url).getHost().endsWith("example.com")) { + Uri uri = Uri.parse(url); + if (uri.getHost() != null && uri.getHost().contains("example.com")) { return false; } @@ -17,4 +18,4 @@ public class MyWebViewClient extends WebViewClient { view.getContext().startActivity(intent); return true; } -} \ No newline at end of file +}