TaskStackBuilder无法正常工作

时间:2016-01-07 15:10:47

标签: android

我正在尝试创建合成堆栈,但它无法正常工作。     这是我的代码。

      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);

清单条目

        <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"/>>

我经历了Android - Build a notification, TaskStackBuilder.addParentStack not working以解决问题。

0 个答案:

没有答案