Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

White screen is displayed while switching between Activities

When I move from one Activity to another Activity, a white screen is displayed for 2 seconds. I am using this code:

Intent intent = new Intent(this, SecondActivity.class);
startActivity(intent);

How can I resolve this issue?

like image 921
androidXXX Avatar asked Oct 16 '15 04:10

androidXXX


People also ask

Why is my app showing a white screen?

If your apps are moved to your SD card, and you are running them from there, this might be the cause of the white screen of death issue. You can fix this by moving the apps back to the internal storage. Install the free Move app to SD card app on your phone.

How to remove the white splash screen Android?

The preview window can itself be disabled by adding the following line in the android/app/src/main/res/values/styles. xml file. However disabling the preview window introduces an undesirable delay between clicking on the app icon and the actual launching of the app.


2 Answers

Create a Theme like this:

<style name="YourTheme" parent="YourParentTheme">
    <item name="android:windowDisablePreview">true</item>
</style>

Apply this theme to your second activity

More detail in this link: http://www.tothenew.com/blog/disabling-the-preview-or-start-window-in-android/

like image 197
Ziwei Zeng Avatar answered Sep 18 '22 14:09

Ziwei Zeng


If your activity contains more complex layouts, do not use finish() after setting flag. Use FLAG_ACTIVITY_CLEAR_TOP and _TASK instead and it will solve your problem.This worked for me perfectly

Intent intent = new Intent(this, SecondActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.l̥FLAG_ACTIVITY_CLEAR_TOP ); startActivity(intent);

or use simply like below

Intent intent = new Intent(this, SecondActivity.class); startActivity(intent);

like image 35
Sagar Avatar answered Sep 19 '22 14:09

Sagar