Updating a Notification

At some time, you may need to update the view of your notification. Consider the following situation: You have some code that runs in the background to see whether the tasks have been reviewed. This code checks to see whether any notifications are overdue. You decide that after the two-hour mark passes, you want to change the icon of the notification to a red-colored exclamation point and flash the LED quickly with a red color. Thankfully, updating the notification is a fairly simple process.

If you call one of the notify() methods with an ID that is currently active in the status bar, and with a new set of notification parameters, the notification is updated in the status bar. Therefore, to update your notification, simply create a new Notification object with the red icon as a parameter and call notify().

Get Android™ Tablet Application Development For Dummies® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.