File tree Expand file tree Collapse file tree
app/src/main/java/name/cpr Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -71,12 +71,24 @@ public void toggledFullscreen(boolean fullscreen)
7171 }
7272 });
7373 webView .setWebChromeClient (webChromeClient );
74-
74+ // Call private class InsideWebViewClient
75+ webView .setWebViewClient (new InsideWebViewClient ());
76+
7577 // Navigate anywhere you want, but consider that this classes have only been tested on YouTube's mobile site
7678 webView .loadUrl ("http://m.youtube.com" );
7779
7880 }
7981
82+ private class InsideWebViewClient extends WebViewClient {
83+ @ Override
84+ // Force links to be opened inside WebView and not in Default Browser
85+ // Thanks http://stackoverflow.com/a/33681975/1815624
86+ public boolean shouldOverrideUrlLoading (WebView view , String url ) {
87+ view .loadUrl (url );
88+ return true ;
89+ }
90+ }
91+
8092 @ Override
8193 public void onBackPressed ()
8294 {
You can’t perform that action at this time.
0 commit comments