I have an android application that I am developing using the emulator running on android 2.3.3 with an embedded WebView in a framelayout nested in a linearlayout (vertical). No matter what code I use it never actually does anything. I have Permissions on the android application set to INTERNET. Even when trying to load just the HTML code. I get a blank white page, no errors no nothing. Nothing in logcat as well.
WebView wview = (WebView)findViewById(R.id.webView1);
wview.getSettings().setJavaScriptEnabled(true);
I have tried all three of these to attempt to load anything into the webview:
wview.loadUrl("http://www.google.com");
wview.loadData("<HTML><BODY><H3>Test</H3></BODY></HTML>","text/html","utf-8");
wview.loadDataWithBaseURL(null, "<HTML><BODY><H3>Test</H3></BODY></HTML>","text/html","utf-8",null);
All three give me the same results. Nothing.
Any ideas?
WebSettings settings = wbView.getSettings();
settings.setDomStorageEnabled(true);
It might be a bit too late, but I wanted to share my experience with you, because I had the same problem and spent a lot of time on it.
Put your WebView
in RelativeLayout
and not in FrameLayout
.
What I have tested: My WebView
's onPageFinished()
was called every time, but on the screen I got blank page.
From chrome://inspect
WebView
debugger I was able to "ping" my WebView
by pressing inspect
button, and after that WebView
was refreshing immediately.
My thoughts - WebView
isn't rendered correctly in FrameLayout
, and RelativeLayout
fixes the issue (even invalidate()
and requestLayout()
calls didn't help).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With