minor fixes
This commit is contained in:
parent
5c8b5286ab
commit
37ec256891
@ -15,7 +15,7 @@ If you want to create an app that displays the content of a remote website
|
|||||||
mWebView.setWebViewClient(new MyWebViewClient());
|
mWebView.setWebViewClient(new MyWebViewClient());
|
||||||
```
|
```
|
||||||
|
|
||||||
2. open the `MyWebViewClient.java` file and replace `example.com` on line **14** with your custom hostname
|
2. open the `MyWebViewClient.java` file and replace `example.com` on line **15** with your custom hostname
|
||||||
|
|
||||||
```java
|
```java
|
||||||
if (Objects.requireNonNull(Uri.parse(url).getHost()).endsWith("example.com")) {
|
if (Objects.requireNonNull(Uri.parse(url).getHost()).endsWith("example.com")) {
|
||||||
|
@ -9,6 +9,7 @@ import java.util.Objects;
|
|||||||
|
|
||||||
class MyWebViewClient extends WebViewClient {
|
class MyWebViewClient extends WebViewClient {
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||||
if (Objects.requireNonNull(Uri.parse(url).getHost()).endsWith("example.com")) {
|
if (Objects.requireNonNull(Uri.parse(url).getHost()).endsWith("example.com")) {
|
||||||
|
Loading…
Reference in New Issue
Block a user