tags:

views:

145

answers:

1

Hi i am displaying an icon in status bar.Now i want to remove that icon immediately when i open that content , after some time if we receive any alert ,that icon will be displayed again.For this what can i do?Thanks in advance

+3  A: 

Use the NotificationManager to cancel your notification. You only need to provide your notification id

http://developer.android.com/intl/de/reference/android/app/NotificationManager.html

private static final int MY_NOTIFICATION_ID= 1234;
String ns = Context.NOTIFICATION_SERVICE;
NotificationManager mNotificationManager;
mNotificationManager = (NotificationManager) getSystemService(ns);
mNotificationManager.notify(MY_NOTIFICATION_ID, notification);

The example code is not complete. It depends on how your created your notification. Just make sure you use the same id to cancel your notification as you used when you created your notification.

To cancel:

mNotificationManager.cancel(MY_NOTIFICATION_ID);
PHP_Jedi