I have some Activites that are started from my main Activity. When I go to one of these Activities, press home, kill the process, return to the app (where it resumes on Activity I left from), and then press back, it just closes my app instead of going back to my main Activity. I expect the back stack to be preserved. Does anyone know why this is happening?
I'm doing 3 things that might be related:
(1) My main Activity has launch mode singleTask
I tried removing this, but it didn't solve the problem. For example:
<activity
android:name=".activities.ActivityMain"
android:launchMode="singleTop"
android:screenOrientation="portrait">
</activity>
(2) I'm overriding onBackPressed() in the secondary Activity, but calling super.onBackPressed() when I do indeed want to go back. I also tried not doing this, but it also didn't help. For example:
@Override
public void onBackPressed()
{
Logger.d("ENTER");
ViewUtils.closeKeyboard(this);
//kv If it's a valid location, but hasn't changed, then just finish up
if (((FragmentLocation) getFragment()).isValidSpecifiedLocation()
&& !((FragmentLocation) getFragment()).sendUserSpecifiedLocation())
{
finish();
overridePendingTransition(R.anim.slide_in_from_left, R.anim.slide_out_to_right);
}
}
(3) I'm setting the parent Activity in the manifest to my main Activity (I've also tried removing this, but it doesn't help):
<activity
android:name=".activities.ActivityLocation"
android:screenOrientation="portrait"
android:parentActivityName=".activities.ActivityMain">
</activity>
Any ideas?
UPDATE:
I tried recreating a very simple example with these conditions, but couldn't reproduce. I'm not sure what's causing this issue at this point.