aj79eg
Last Updated: February 25, 2016
·
9.346K
· emincan
Canvas

Adding a splash screen and clearing cache with PhoneGap and Android

To add a splash screen in a PhoneGap Android application, first create a splash image in png format and copy it to the project's res/drawable folder.
Also, when using webview in android application, cache is getting bigger and bigger with dynamic content. It is also possible clear this cache on application startup with the code below.

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    super.setIntegerProperty("loadUrlTimeoutValue", 60000);
    // set splash screen
    super.setIntegerProperty("splashscreen", R.drawable.splash);
    super.init();
    // clear cache
    super.clearCache();
    super.loadUrl("file:///android_asset/www/index.html");
}
Say Thanks
Respond