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?
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.
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.
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/
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);
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