I am facing one issue and its a bit weird. My case is, I have two Activity A and B. A is my launcher activity so when i open app A is presented. Now from button click i start another activity B.
Now i am placing my app in background by pressing home button of the phone. and coming again in the app from recent. Now i am in activity B when my app comes to foreground.
Now when i press back button my application is closing instead of going back to Activity A.
Why is this happening can anyone please explain and also how can i solve this?
Thanks in advance.
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity"
android:launchMode="singleInstance"
android:screenOrientation="portrait"
android:noHistory="false">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".SecondActivity"
android:screenOrientation="portrait">
</activity>
</application>