Reputation: 5006
I'm currently converting my app from being a phonegap/cordova app, to using a native android webview (as i don't use any cordova plugins and want to add ads). There is one issue i'm facing which doesn't appear in the cordova build however. Whenever i click a link to switch pages, the application blinks, and then the page transition happens. Like i said, this does not happen in the phonegap/cordova build, and the html/javascript are identical.
Heres my android source
package com.h2programming.epnext;
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
public class EpisodeNext extends Activity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
setupWebview();
}
private void setupWebview() {
WebView view = (WebView)findViewById(R.id.webview);
WebSettings settings = view.getSettings();
view.setInitialScale(0);
view.setVerticalScrollBarEnabled(false);
view.requestFocusFromTouch();
settings.setJavaScriptEnabled(true);
settings.setDomStorageEnabled(true);
settings.setDatabasePath("/data/data/com.h2programming.epnext/databases");
settings.setJavaScriptCanOpenWindowsAutomatically(true);
settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NORMAL);
view.loadUrl("file:///android_asset/index.html");
}
}
I've tried to add methods from cordova/phonegaps DroidGap activity but I can't seem to find the piece which keeps my webview from blinking upon switching pages (i just want an immidiate transition). Does anyone have any idea how to stop this?
Thanks!
Upvotes: 1
Views: 1305
Reputation: 5006
It appears to be a bug in ICS when hardware acceleration is enabled. This has been fixed in Jelly Bean.
Upvotes: 1