Listing 920 Setting Notification values

Context context = getApplicationContext(); // Text to display in the extended status window String expandedText = "Extended status text"; // Title for the expanded status String expandedTitle = "Notification Title";

// Intent to launch an activity when the extended text is clicked Intent intent = new Intent(this, MyActivity.class);

Pendinglntent launchlntent = PendingIntent.getActivity(context, 0, intent, 0);

notification.setLatestEventInfo(context, expandedTitle, expandedText, launchIntent);

s good form to use one Notification icon to represent multiple instances of the same event (e.g., receiving multiple SMS messages). To do this, update the values set by setLatestEventinfo to reflect the most recent message (or a summary of multiple messages) and re-trigger the Notification to update the display values.

Prepared for ASHLEE KABAT, email: [email protected] Order number: 56760408 This PDF is for the purchaser's personal use in accordance with the Wrox Terms of Service and under US copyright as stated on this book's copyright page. If you did not purchase this copy, please visit to purchase your own copy.

Notifications m New email


Available for download on

If the details available in the standard extended view are insufficient (or unsuitable) for your Notification, you can create your own layout and assign it to your Notification using a Remote View. Figure 9-5 shows the custom layout defined, assigned, and modified in Listings 9-21, 9-22, and 9-23, respectively.

Ongoing turrentPfcgrejv


Listing 9-21 defines a custom layout that includes an icon, Text View, and progress bar.

Available for download on

Was this article helpful?

0 0
Mobile Apps Made Easy

Mobile Apps Made Easy

Quick start guide to skyrocket your offline and online business success with mobile apps. If you know anything about mobile devices, you’ve probably heard that famous phrase coined by one of the mobile device’s most prolific creators proclaiming that there’s an app for pretty much everything.

Get My Free Training Guide

Post a comment