In my application, I create a notification which starts Details Activity. I want to add this activity to top of current task (or back stack). For example I expect application task (back stack) to behave like this:
but I get this:
I have not used FLAG_ACTIVITY_CLEAR_TASK
and FLAG_ACTIVITY_NEW_TASK
flags. What should I do?
Edit: First picture is just an example. I think the the question's title is completely explicit. I want to add Details Activity on top of current stack, and not to start with a new task.
This is how I create the PendingIntent
:
// Details activity intent
Intent intent = new Intent(context, DetailsActivity.class);
intent.putExtra(Com.KEY_ID, event.getId());
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0,
intent, PendingIntent.FLAG_UPDATE_CURRENT);
And this is the manifest:
<activity
android:name=".MainActivity"
android:label="@string/app_name_system"
android:launchMode="singleTop"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".NoteActivity"
android:label="@string/app_name_system"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="stateHidden" />
<activity
android:name=".DetailsActivity"
android:launchMode="singleTop"
android:label="@string/app_name_system"
android:theme="@style/AppTheme.NoActionBar" />
Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP
for the intent? – Portwine