1
votes

I want to use splash screen in my application when running the app but when I launch the app in android device first shows me the blank activity at 0.5 second then shows up the splash screen this is my code I'm using.

public class MyActivity extends DroidGap {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        super.setIntegerProperty("splashscreen", R.drawable.splash);
        super.loadUrl("file:///android_asset/www/index.html", 3000);
    }
}   
4

4 Answers

0
votes

Try this :

 public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    super.init();
    super.clearCache();
    super.clearHistory();
    super.setIntegerProperty("splashscreen", R.drawable.splash);
    super.loadUrl("file:///android_asset/www/index.html");
}

Although a bit of delay is quite usual, try deploying app to phone and check.

0
votes

The first blank/black screen that appear before any splashscreen of your app is normal.

That black screen is a sort of Android internal base screen that Android shows for your app while it fork a process in the Dalvik JVM and load your resources/classes. it happen for any Android app. it is not related to Phonegap. Android make this to give the user the impression of a "fast app launch" while it instead is still loading your code.

Anyway you can style that black screen to make it appear as near as possible to the theme of your app so the user have the impression the app is ready and launched but it is loading internal content.

You can read more about it here: http://cyrilmottier.com/2013/01/23/android-app-launching-made-gorgeous/

0
votes

In the file res/values/themes.xml enter the code:

<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
    <style name="YourTheme" parent="@style/YourParentTheme"> 
       <item name="android:windowDisablePreview">true</item>
    </style>
</resources>