ボタンのクリックで閉じたいという通知があります。SetAutoCancel を使用していますが、機能しません。誰でもそれを達成する方法の手がかりを得ましたか? このボタンの使用remoteViews.setOnClickPendingIntent(R.id.notificationbutton, pIntent);
コード
RemoteViews remoteViews = new RemoteViews(getPackageName(),
R.layout.customnotification);
String strtitle = getString(R.string.customnotificationtitle);
Intent intent = new Intent(this, NotificationView.class);
intent.putExtra("text", strtext);
PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent,
PendingIntent.FLAG_UPDATE_CURRENT);
remoteViews.setOnClickPendingIntent(R.id.notificationbutton, pIntent);
NotificationCompat.Builder builder = new NotificationCompat.Builder(
this).setSmallIcon(R.drawable.logosmall)
.setTicker(getString(R.string.customnotificationticker))
.setAutoCancel(true).setContentIntent(pIntent)
.setContent(remoteViews);
remoteViews.setImageViewResource(R.id.imagenotileft,
R.drawable.ic_launcher);
remoteViews.setTextViewText(R.id.title,
getString(R.string.customnotificationtitle));
remoteViews.setTextViewText(R.id.text,
getString(R.string.customnotificationtext));
NotificationManager notificationmanager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
notificationmanager.notify(0, builder.build());