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
1e485532
Unverified
Commit
1e485532
authored
5 years ago
by
Max
Committed by
GitHub
5 years ago
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8 from hypothermic/master
Fix NullPointerException in MyWebViewClient
parents
37ec2568
811160c7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
MyWebViewClient.java
app/src/main/java/com/example/app/MyWebViewClient.java
+3
-2
No files found.
app/src/main/java/com/example/app/MyWebViewClient.java
View file @
1e485532
...
@@ -12,7 +12,8 @@ class MyWebViewClient extends WebViewClient {
...
@@ -12,7 +12,8 @@ class MyWebViewClient extends WebViewClient {
@SuppressWarnings
(
"deprecation"
)
@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"
))
{
Uri
uri
=
Uri
.
parse
(
url
);
if
(
uri
.
getHost
()
!=
null
&&
uri
.
getHost
().
contains
(
"example.com"
))
{
return
false
;
return
false
;
}
}
...
@@ -20,4 +21,4 @@ class MyWebViewClient extends WebViewClient {
...
@@ -20,4 +21,4 @@ class MyWebViewClient extends WebViewClient {
view
.
getContext
().
startActivity
(
intent
);
view
.
getContext
().
startActivity
(
intent
);
return
true
;
return
true
;
}
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
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