Android train-notification Notifications

Source: Internet
Author: User

Notification

Extends Object
Implements Parcelable

Java.lang.Object

?
Android.app.Notification

Public Constructors: a more commonly used construction method

Notification (int icon, charsequence tickertext, long when)

Constructs a Notification object with the information needed to has a status bar icon without the standard expanded view.

Public Methods

void Setlatesteventinfo (

Context Context,

Charsequence Contenttitle,

Charsequence ContentText,

Pendingintent contentintent)

Sets contentView the field to is a view with the "Latest Event" layout.

Creating a Notification

inticon = R.drawable.notification_icon;//icon from ResourcesCharsequence tickertext = "Hello";//Ticker-textLongwhen = System.currenttimemillis ();//Notification TimeContext context = Getapplicationcontext ();//Application ContextCharsequence contenttitle = "My notification";//expanded Message titleCharsequence contenttext = "Hello world!";//expanded message textIntent notificationintent=NewIntent ( This, MyClass.class); Pendingintent contentintent= Pendingintent.getactivity ( This, 0, notificationintent, 0);//the next lines initialize the Notification, using the configurations aboveNotification Notification =NewNotification (icon, Tickertext, when); Notification.setlatesteventinfo (context, Contenttitle, ContentText, contentintent);

Android train-notification Notifications

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.