Dans Android comment puis-je connaître l'id de notification pour effacer la notification

Maintenant sur android j'ai mis ce code dans une activité à afficher une notification lorsqu'une touche est appuyée.

static int notificationCount = 0;

puis

 btnNotification.setOnClickListener(
            new View.OnClickListener() {
                @Override
                public void onClick(View v) {

                    Intent notificationIntent = new Intent(AlertsActivity.this,NotificationActivitty.class);
                    PendingIntent pIntent = PendingIntent.getActivity(AlertsActivity.this,notificationCount,notificationIntent,Intent.FLAG_ACTIVITY_NEW_TASK);

                    //Construct the notification
                    Notification.Builder nBuilder = new Notification.Builder(AlertsActivity.this);
                    nBuilder.setContentTitle("You Have a notification!");
                    nBuilder.setContentText("See Your Notification");
                    nBuilder.setSmallIcon(android.R.drawable.btn_star);
                    nBuilder.setContentIntent(pIntent);
                   nBuilder.addAction(android.R.drawable.stat_notify_call_mute, "go to", pIntent); //from icecream sandwatch - required api 16

                    //Build the notification
                    Notification noti = nBuilder.build(); //required api 16

                    //Send it to manager
                        NotificationManager manager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
                        manager.notify(notificationCount++,noti);
                }
            }
    );

De gestionnaire de Notification, Toute notification que j'ai cliqué sur elle, elle me diriger vers une autre activité (NotificationActivity)

Maintenant j'ai mis ce code pour effacer la notification mais c'est seulement à effacer la notification avec l'id 0, alors comment puis-je effacer le courant pressé de notification

public class NotificationActivitty  extends Activity{

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_notification);

    NotificationManager manager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
    manager.cancel(0);
    //manager.cancelAll(); //Cancel all notifications for this app. from manager

}

J'ai besoin d'effacer la notification par l'id si c'est possible.

je pense que la question n'est pas trop dur 🙁

OriginalL'auteur Marzouk | 2015-07-24