SoFunction
Updated on 2025-03-08

Solution to the black screen when switching (jump) of Android Activity Share

When two activities are redirected, since the second activity loads a lot of data at startup, a short black screen time will appear before starting. The simplest way to solve this problem is to set the theme of the second activity to be transparent, so that the black screen when starting the second activity becomes to display the first activity interface. This is done in two steps:
Step 1: Add the Theme of the custom Activity to xxx/res/values/, as shown below:

[html]  <style name="Transparent" parent="android:">
<!--Set the Theme of the Activity to transparent->
        <item name="android:windowIsTranslucent">true</item>
    </style>

<style name="Transparent" parent="android:">
<!--Set the Theme of the Activity to transparent->
        <item name="android:windowIsTranslucent">true</item>
</style>Step 2: Set the "android:theme" property of the second activity to the theme style you just customized. As shown below:

[html]  <activity
    android:name=""
    android:label="@string/app_name"
    android:theme="@style/Transparent">

        <activity
            android:name=""
            android:label="@string/app_name"
android:theme="@style/Transparent">                                                                                                                                                                                                                                                       �