As said here
When the user leaves a task by pressing the Home button, the current activity is stopped and its task goes into the background. <...> If the user later resumes the task by selecting the launcher icon that began the task, the task comes to the foreground and resumes the activity at the top of the stack.
So i prepared simple test
Activity #1 == text mark and button with onClick set
public class FirstActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.first_layout);
}
public void onClick(View v)
{
Intent intent = new Intent(FirstActivity.this, SecondActivity.class);
startActivity(intent);
}
}
Activity #2 == just text mark
public class SecondActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.second_layout);
}
}
And manifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="10"/>
<application android:label="@string/app_name" android:icon="@drawable/ic_launcher">
<activity android:name="FirstActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name="SecondActivity"
android:label="@string/app_name">
</activity>
</application>
</manifest>
Launcher icon does not show me last activity, it is always launchs first activity and put it into stack. So in one task there might be many first and many second activities. Icon from recent apps list launch exact last activity in stack. What am i doing wrong?
There is an issue depending on how you are launching your app. If your start your app from your IDE when try this: please stop your application from options->applications. Then start your app from homescreen as usual users do. I expect in this case back stack behaviour would be normal