title: Cancel notification in android
body: <p>i have a reminder application, it triggers notification for few of the tasks, suppose if i delete or opens a notified task i want to clear that particular notification</p>
  
  <p>i tried this solution</p>
  
  <pre><code>NotificationManager notificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
  notificationManager.cancel(NOTIFICATION_ID);
  </code></pre>
  
  <p>Here, always while opening the task i need to call this method with notification ID, so does it cause problem to my application?</p>
  
  <p>If so, is there a way to check if the notification for a ID is exist &amp; then clear it?</p>