Why Android apps act differently when opening app from application icon and opening from Recent apps (after exiting application by pressing Home button)?
Example : Start Activity A -> Activity B then press home button.
Opening application from app icon will take you back to Activity A.
Opening application from recent apps will take you to Activity B.
Setting attribute "android:alwaysRetainTaskState" to "true" will solve this problem as this will retain the state of the activity as it is. It doesn't allow system to reset activity state.
Whether or not the state of the task that the activity is in will always be maintained by the system — "true" if it will be, and "false" if the system is allowed to reset the task to its initial state in certain situations. The default value is "false". This attribute is meaningful only for the root activity of a task; it's ignored for all other activities."