0

I have the following manifest:

<application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"

    <activity
            android:name=".LoginActivity" android:launchMode="singleTask" android:screenOrientation="portrait">
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity>

    <activity android:name=".MainActivity" android:screenOrientation="portrait"/>
    <activity android:name=".TaskDetailActivity" android:screenOrientation="portrait"/>
    <activity android:name=".ConfigurationActivity" android:screenOrientation="portrait"/>

</application>

I don't know why, if I minimize the application and then i click on application icon, the app get relaunched instead of going to the last activity.

If I use application switcher instead of application icon for opening the application, It goes back to the last activity on use, so it works as expected.

Why is this behavior? I want to open the last activity when I click on application icon not restart the whole application.

Lechucico
  • 1,914
  • 7
  • 27
  • 60

1 Answers1

0

An Activity with singleTask launchMode is allowed to have only one instance in the system. Remove android:launchMode="singleTask" for more about singletask

Hemant Parmar
  • 3,924
  • 7
  • 25
  • 49