我正在尝试使用新的通知界面。 我已经在通知中添加了3个button,并且每次单击它们时都想将其保存到数据库中。 通知本身运作良好,被调用时显示,我只是不知道如何捕获三个不同的button点击每一个。 我正在使用BroadcastReceiver来捕捉点击,但我不知道如何分辨哪个button被点击。 这是AddAction的代码(我已经排除了其他的通知,因为它的工作很好) – //Yes intent Intent yesReceive = new Intent(); yesReceive.setAction(CUSTOM_INTENT); Bundle yesBundle = new Bundle(); yesBundle.putInt("userAnswer", 1);//This is the value I want to pass yesReceive.putExtras(yesBundle); PendingIntent pendingIntentYes = PendingIntent.getBroadcast(this, 12345, yesReceive, PendingIntent.FLAG_UPDATE_CURRENT); mBuilder.addAction(R.drawable.calendar_v, "Yes", pendingIntentYes); //Maybe intent Intent maybeReceive = new Intent(); maybeReceive.setAction(CUSTOM_INTENT); Bundle maybeBundle = new Bundle(); maybeBundle.putInt("userAnswer", 3);//This is […]