Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do they load a url inside a webview instead of androids internal browser?

I'm trying to achieve this: MKyong - WebView. To get a hint at what exactly, then take a look at the last picture before "Download Source Code".

My applications code is:

bookingView = (WebView) findViewById(R.id.fullscreen_content);
bookingView.getSettings().setJavaScriptEnabled(true);
bookingView.loadUrl("http://www.google.com");

But what that code does is opening the url(in this case Google) inside the default browser/internal browser in android and it's not meant to be that in the android application I am making.

Any ideas?

like image 981
Erik Avatar asked Oct 09 '15 19:10

Erik


1 Answers

Add this line before the loadUrl() call

bookingView.setWebViewClient(new WebViewClient());
like image 120
Alberto S. Avatar answered Nov 11 '22 11:11

Alberto S.