Skip to content Skip to sidebar Skip to footer

How To Avoid Black Screen When Intent.flag_activity_new_task | Intent.flag_activity_clear_task Is Set?

In my android app, I need to use Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK to set my intent flag. I can remove all my previous Activities and start a new Acti

Solution 1:

This initial screen that you see is called the "Preview" screen. You can disable this completely by declaring this in your theme:

android:windowDisablePreview

<stylename="Theme.MyTheme"parent="android:style/Theme.Holo"><!-- This disables the black preview screen --><itemname="android:windowDisablePreview">true</item></style>

Solution 2:

Try this

Intent intent = newIntent(Gerenxinxi.this, MainPart.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
finish();

Solution 3:

only one solution i found it instead of showing black screen show app theme background. in my case its white

<applicationandroid:name="com.my.MyApplication"android:allowBackup="true"android:icon="@drawable/launcher"android:label="@string/app_name"android:theme="@style/Theme.MyTheme”>


   <style name="Theme.MyTheme" parent="android:style/Theme.Holo"><!-- This disables the black preview screen --><itemname="android:windowDisablePreview">true</item></style>

Solution 4:

Add this line in your style

android:windowDisablePreview = true.

Post a Comment for "How To Avoid Black Screen When Intent.flag_activity_new_task | Intent.flag_activity_clear_task Is Set?"