这是我在单击按钮时调用的方法。
public void onDisplayNotification(View v)
{
Intent i = new Intent(this, Notification_Activity.class);
i.putExtra("Code", "Notification Dismissed");
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, i, 0);
NotificationCompat.Builder nb = new NotificationCompat.Builder(this);
nb.setContentTitle("Meeting").setContentText("In 5 minutes").setContentIntent(pendingIntent);
NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
Log.d("my","Hello");
nm.notify(0, nb.build());
}
单击按钮时不显示任何内容。我检查了日志猫,该方法正在运行。