Search code examples
androidandroid-intentandroid-studiosplash-screen

Splash Screen Doesn't Display First On The Application


Good day, I'm doing a project and, I'm new with android development also, I just want to ask how to display my[the] splash screen first on my app (when starting up my application). Whenever I run it on emulator or on my device it directly go to my main activity.

Splash Screen Image

enter image description here

Main NavDrawer

enter image description here

I even reorder my manifest file list - and place the splash screen first here my code

<!-- For Splash Screen -->
    <activity
        android:name=".activities.SplashScreen"
        android:screenOrientation="portrait"
        android:theme="@style/Theme.AppCompat.NoActionBar" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>



    <!-- For Main Activity -->
    <activity android:name=".activities.MainActivity" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

Whenever I exit my app and start again, my splash screen is gone! It directly go to Main Activity.

Thanks in advance! :)


Solution

  • You are having 2 LAUCHERS...

    Make sure that only the Splash Screen Activity is the LAUNCHER.
    Let the Main Activity be a DEFAULT one (and also the HOME one).