Web page does not open in my WebView [duplicate]

2

I made a browser using WebView , but when I call loadUrl(); it opens the page in the default Android browser. How do I open it inside my browser?

    
asked by anonymous 08.06.2016 / 15:08

1 answer

3

You need to define where it will open, for example:

WebView myWebView = (WebView) rootView.findViewById(R.id.webView);
myWebView.getSettings().setJavaScriptEnabled(true);

myWebView.addJavascriptInterface(new MyJavaScriptInterface(), "HTMLOUT");
myWebView.setWebViewClient(new MyWebViewClient());
myWebView.getSettings().setUseWideViewPort(false);
myWebView.loadUrl(url);

This forces the URL to be opened in your declared WebView in XML.

Hugs.

    
08.06.2016 / 15:31