1

I am trying to create synthetic stack but it is not working. Here is my code.

      Intent resultIntent = new Intent(context, NotificationListScreen.class);
            resultIntent.setFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
            TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);
            // Adds the back stack
            stackBuilder.addParentStack(NotificationListScreen.class);
            // Adds the Intent to the top of the stack
            stackBuilder.addNextIntent(resultIntent);
            // Gets a PendingIntent containing the entire back stack
            PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);

            // Puts the PendingIntent into the notification builder
            builder.setContentIntent(resultPendingIntent);
            // Kills the notification when user clicks on it
            builder.setAutoCancel(true);

Manifest Entry

        <activity
        android:name=".modules.notification.NotificationListScreen"
        android:screenOrientation="portrait"            android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
        android:label="@string/title_activity_notification_list_screen"
        android:parentActivityName=".modules.splash.SplashScreen">
        <meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value=".modules.splash.SplashScreen"/>>

I went through this Android - Build a notification, TaskStackBuilder.addParentStack not working for trouble shooting.

Community
  • 1
  • 1
Ishan
  • 1,172
  • 10
  • 25
  • Do you want to add parent stack of `NotificationListScreen` to the back stack? Or you want to navigate to SplashScreen. If its former, then what is the parent activity of `NotificationListScreen`? – Sagar Mar 29 '18 at 12:55

0 Answers0