Skip to content Skip to sidebar Skip to footer

How To Make Splash Screen Not To Load If App Is Already In Memory

I have some troubles with spash screen. When I launch app, splash screen activity launches for some seconds. After it main activity launches. And if i press home button on the main

Solution 1:

This is a design problem. Your launcher activity should not be your splash screen activity. Instead, open your splash activity in your main activity's onCreate method. That way, if it is opened fresh, onCreate is called and the splash screen is shown. Otherwise, if the app is merely resumed, which calls onResume, there would be no call to open the splash screen activity.

Then you can change your manifest to this:

<activityandroid:name=".ui.MainActivity"android:noHistory="true"android:screenOrientation="portrait"android:label="@string/app_name"><intent-filter><actionandroid:name="android.intent.action.MAIN"/><categoryandroid:name="android.intent.category.LAUNCHER"/></intent-filter></activity><activityandroid:name=".ui.SplashActivity"/>

Post a Comment for "How To Make Splash Screen Not To Load If App Is Already In Memory"