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