I'm stuck with some activity's flow issue. The desired behaviour is the following:
From time to time, the user receives a notification. When this notification is clicked, a new Activity
is opened with some information in it. In this Activity, there's a button whose purpose is to redirect the user to another Activity
where more detailed information is showed. When the user is in the details Activity and presses the back button (or the back button in the ActionBar
) this one is closed and the Main Activity is showed (this one is different from the one I mentioned in first place).
Everything works fine except from the last part. When the user presses the back button the application is closed and it is showed the Home Screen. Why is that happening?
Here is my AndroidManifest.xml
:
<activity
android:name=".MainActivity">
</activity>
<activity
android:name=".DetailActivity"
android:label="@string/title_detail_activity"
android:parentActivityName="solar.panik.MainActivity" >
<!-- Parent activity meta-data to support 4.0 and lower -->
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="solar.panik.MainActivity" />
</activity>
<activity
android:name=".NotificationActivity"
android:theme="@style/NotificationActivity"
android:excludeFromRecents="true">
</activity>
Here is the onClick code for the button that starts the DetailActivity
from the NotificationActivity
:
Intent intent = new Intent(NotificationActivity.this, DetailActivity.class);
startActivity(intent);
finish();
Thanks in advance