android - WebView - load links in external browser -


itemprop = "text">

I am loading content of a locally stored html file in a WebView This file also contains a link in my app, when clicking, load url in the same WebView . I want to load these links instead of in an external browser. I have taken a look at onPageStarted and shouldOverrideUrl loading , but they do not work I have tried the following:

  webAbout = ( WebView) findViewById (R.id.wvAbout); WebAbout.loadUrl (Const.defURL); WebAbout.setWebViewClient (New WebViewClient) {@Override Public Zero onPageStarted (for viewing WebView, string URL, bitmap favicon) {if (url.startsWith (Const.defURL)) {view.stopLoading (); // go Cheese} else {View.loadUrl (Const.defURL);}}});   

I have also tried:

  webAbout = (WebView) findViewById (R.id.wvAbout); WebAbout.loadUrl (Const.defURL); WebAbout.setWebViewClient (New WebViewClient () {Public Boolean shouldOverrideUrlLoading (WebView to see, string URL) {if (url = Null & amp;! (Url.startsWith (Const.defURL)) {webAbout.loadUrl ( Const.defURL) Return;} and {view.getContext (.) StartActivity (New Intent (Intent.ACTION_VIEW, Uri.parse (url)) Return Return;}}});   

But in both cases, WebView does not load anything, any ideas where I am getting wrong?

just try

  WebView = (WebView) findViewById (R .id.wvAbout); String url = ""; WebView.loadUrl (url);   

Or write this condition

  if (urlPath .compareToIgnoreCase (Const.defURL) == 0) {} else {mWebView.setWebViewClient (New WebViewClient ( ) {@Override Public Boolean shouldOverrideUrlLoading (WebView to see, string URL) {view.clearView (); view.loadUrl (return);}}); }    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -