Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
webview
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
webview
Commits
37ec2568
Commit
37ec2568
authored
Jan 22, 2019
by
slymax
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor fixes
parent
5c8b5286
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
1 deletion
+2
-1
README.md
README.md
+1
-1
MyWebViewClient.java
app/src/main/java/com/example/app/MyWebViewClient.java
+1
-0
No files found.
README.md
View file @
37ec2568
...
@@ -15,7 +15,7 @@ If you want to create an app that displays the content of a remote website
...
@@ -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
**1
4
**
with your custom hostname
2.
open the
`MyWebViewClient.java`
file and replace
`example.com`
on line
**1
5
**
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")) {
...
...
app/src/main/java/com/example/app/MyWebViewClient.java
View file @
37ec2568
...
@@ -9,6 +9,7 @@ import java.util.Objects;
...
@@ -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"
))
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment