In my application, I create a notification that triggers an Activity Activity . I want to add this activity to the top of the current task (or back to the stack). For example, I expect the application task (back stack) to behave as follows:

but I understand:

I have not used FLAG_ACTIVITY_CLEAR_TASKand FLAG_ACTIVITY_NEW_TASK. What should I do?
Change: The first image is just an example. I think the title of the question is completely clear. I want to add Detailed activity on top of the current stack, rather than starting with a new task.
This is how I create PendingIntent:
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 manifested:
<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" />