3

How do you get rid of the white screen flash on android/phonegap application launches? It appears to be showing the activity_main.xml for a split second, I have tried changing the background color to black to make it less noticeable. I assume there is a way to hide that altogether?

Greg Tyndall
  • 117
  • 1
  • 6

3 Answers3

1

The problem is the WebView needs to be instantiated first and it defaults to a blank white page and then loadUrl is called which loads your application code. One way to get around it is to show a splashscreen until your app is loaded in the background.

phonegap - splash screen for Android app

Community
  • 1
  • 1
Simon MacDonald
  • 23,253
  • 5
  • 58
  • 74
  • 1
    Perhaps I'm doing something wrong, I previously ran across this post and attempted it, it added a splash screen, but I STILL get the behavior in my question. Now its a flash of the activity_main with a white background, then a splash screen, then my app. Any ideas? – Greg Tyndall Oct 31 '12 at 15:45
0

Based on the theme of your app, you can change the color of this flash background, eg: Light or Dark. This will minimise the effect.

Thasneem
  • 245
  • 1
  • 9
0

I also ran into the same issue. I get around this by setting the activity layout background between init and loadUrl. That way, I got the entire process cover: before splash screen shown, splash screen shown, splash screen hide, and then hide my splash screen after device ready.

super.onCreate(savedInstanceState);
super.init();

// set the layout background
root.setBackgroundDrawable(null);
root.setBackgroundResource(R.drawable.splash);
root.setBackgroundColor(Color.parseColor("#ffffffff"));

super.loadUrl(Config.getStartUrl(), 80000);

To reduce code, I set my splash screen in config.xml:

<preference name="backgroundColor" value="0xffffffff" />
<preference name="splashscreen" value="splash" />
<preference name="AutoHideSplashScreen" value="false" />
<preference name="auto-hide-splash-screen" value="false" />

This is based on Cordova 2.8+. Splash screen on 2.7 is kinda wack.

In addition, if you experience issue with white screen on iOS. See iOS quirk section at bottom here: http://docs.phonegap.com/en/2.8.0/cordova_splashscreen_splashscreen.md.html#Splashscreen

Noogen
  • 1,652
  • 12
  • 13