WebView

+2 George Kav · February 6, 2015
I am watching your tutorials and I'm stuck with the webview idea... I follow exactly what you write and when I try to run the application my logcat fills with errors and the page opens in the default browser instead the webview.. I checked the code many times nothing is different.. any ideas? I'm using android studio

Post a Reply

Replies

Oldest  Newest  Rating
0 Fardin Behboudi · August 22, 2015
if you have problem with not opening the pages in your app like:
-blank screen in webview 
-opening the page in default browser
-not running java script 
and so 
just add some line of code to the onCreateView method in 
 if (mItem != null) {
            ((WebView) rootView.findViewById(R.id.detail_area)).loadUrl(mItem.url);
        } :
and replace it to this lines (add 3 more lines):

if (mItem != null) {
((WebView) rootView.findViewById(R.id.detail_area)).getSettings().setJavaScriptEnabled(true);
((WebView) rootView.findViewById(R.id.detail_area)).setLayerType(View.LAYER_TYPE_SOFTWARE, null);
((WebView) rootView.findViewById(R.id.detail_area)).loadUrl(mItem.url);
 ((WebView) rootView.findViewById(R.id.detail_area)). setWebViewClient(new WebViewClient());
}
+1 Nicholas Eason · February 9, 2015
You need to use a WebViewClient.

myWebView.setWebViewClient(new WebViewClient());

This will enable Javascript, and it will not open the Web Browser, it will just use the WebView.

On a side note, I use WebView just fine along with my Host GPU, and those 3 lines also repeat for me, they don't break anything, so I just figured it's whatever.

You can also edit settings of the WebView (like, if you didn't want to enable JS)

myWebView.getSettings().setJavaScriptEnabled(false);
0 George Kav · February 8, 2015
 18:49:33.518    2290-2311/com.example.george.thenewboston E/eglCodecCommon? glUtilsParamSize: unknow param 0x00000b44
02-08 18:49:33.534    2290-2311/com.example.george.thenewboston E/eglCodecCommon? glUtilsParamSize: unknow param 0x00000bd0
02-08 18:49:33.556    2290-2311/com.example.george.thenewboston E/eglCodecCommon? **** ERROR unknown type 0x73000d (glSizeof,72)


These 3 lines keep repeating.. I read that it has something to do with the option : use host gpu?
  • 1

Java / Android Development

107,274 followers
About

Very popular language used to create desktop applications, website applets, and Android apps.

Links
Moderators
Bucky Roberts Administrator