PDA

View Full Version : Differences between browser and WebView on Android



vasion
3 Sep 2011, 2:55 AM
I have an app that runs beautifully in the Android browser, but when i include it in the embedded webView in my app i get all kinds of bugs (my lists slide, but a second copy remains in the background), components stay in the background when new tabs are opened etc.

What are the differences between the browser and the webview, how can i make my app run normally.

I already have

WebView wv = (WebView) findViewById(R.id.webView);

wv.setWebChromeClient(new WebChromeClient() {
public boolean onConsoleMessage(ConsoleMessage cm) {
Log.w("MyApplication", "poo " + cm.message() + " -- From line "
+ cm.lineNumber() + " of "
+ cm.sourceId() );
return true;
}
});
Log.d("MyApplication", "checking log");
WebSettings webSettings = wv.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setDomStorageEnabled(true);
webSettings.setCacheMode(LOAD_NO_CACHE);
wv.addJavascriptInterface(new JavascriptInterface(this), "Android");
wv.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
wv.setBackgroundColor(0);
wv.loadUrl("file:///android_asset/www/index.html");