I have a SearchAcvitity which has a child PersonActivity. Each are FragmentActivity's. Here's my manifest file:
<activity android:name=".SearchActivity" android:label="@string/search_title">
</activity>
<activity android:name=".PersonActivity" android:label="@string/person_title"
android:parentActivityName=".SearchActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".SearchActivity" />
</activity>
From SearchFragment, I start PersonActivity like so:
Intent i = new Intent(getActivity(), PersonActivity.class);
startActivity(i);
This alone adds the left-facing caret alongside the app icon in PersonFragment. When I press this icon, it recreates SearchAcvitiy (and fragment), so its previous state is lost.
When I instead press the back button from PersonFragment, it goes back to SearchActivity's SearchFragment via onResume(...) and its state is intact. How can I make this happen with the up action?
Please note that I don't make this call in PersonFragment:
getActivity().getActionBar().setDisplayHomeAsUpEnabled(true);