Every when my app starts up, there's a white background displays in a short time. Despite of using splash screen, the problem is still exists. I would like to set the start up screen to black instead of white as default!
This is my splash's screen activity:
public class SplashActivity extends Activity {
private static String TAG = SplashActivity.class.getName();
private static long SLEEP_TIME = 1; // Sleep for some time
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE); // Removes title bar
setContentView(R.layout.splash);
// Start timer and launch main activity
IntentLauncher launcher = new IntentLauncher();
launcher.start();
}
private class IntentLauncher extends Thread {
/**
* Sleep for some time and than start new activity.
*/
@Override
public void run() {
try {
// Sleeping
Thread.sleep(SLEEP_TIME*1000);
} catch (Exception e) {
Log.e(TAG, e.getMessage());
}
// Start main activity
Intent intent = new Intent(SplashActivity.this, MainActivity.class);
SplashActivity.this.startActivity(intent);
SplashActivity.this.finish();
}
}
@Override
protected void onPause() {
super.onPause();
overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
}
}
One of the reliable ways to fix the white screen of death on Android Phones or Tablets is to reboot your phone. First, press down the Power Button and Volume Down together, then tap on reboot. Once your phone reboot, it might result from a virus causing the Phone IOS not to load on time.
in styles.xml, in the theme specified in your AndroidManifest.xml, add the following line:
<item name="android:windowBackground">@android:color/black</item>
Use this tag in your manifest:
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
instead of :
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With