Asif Sb
Asif Sb

Reputation: 805

Minimize and click on app icon, app should not starts from splash

Step 1: Click on app icon opens up a Splash Screen then comes a Login Screen which has edit text fields.

Step 2: Minimize the app, go to home screen and then click on the app icon.

Expected Result: It should start from where I left.

Actual Result: It is starting from the Splash screen.

Here is Manifest code snippet:

 <application
    android:icon="@drawable/app_icon"
    android:label="@string/app_name"
    android:largeHeap="true"
    android:roundIcon="@drawable/app_icon"
    android:supportsRtl="true"
    android:theme="@style/AppThemeMain">

splash:

 <activity
        android:name=".SplashActivity"
        android:label="@string/app_name"
        android:launchMode="singleTask"
        android:noHistory="true"
        android:screenOrientation="portrait"
        android:theme="@style/AppThemeMain">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

Upvotes: 4

Views: 814

Answers (2)

Asif Sb
Asif Sb

Reputation: 805

Finally, I solved it by removing android:launchMode="singleTask" from our manifest.

Upvotes: 4

Lukas Gruber
Lukas Gruber

Reputation: 46

If you mean pressing the back button to minimize the app, just override the onBackPressed() function and call moveTaskToBack(true). Be sure to remove the "super.onBackPressed()"

Upvotes: 0

Related Questions