public Notification (int icon, CharSequence tickerText, long when) was added in API level 1
** This constructor was deprecated in API level 11. **
Use Notification.Builder instead.
Constructs a Notification object with the information needed to have a status bar icon without the standard expanded view.
Parameters:
icon - The resource id of the icon to put in the status bar.
tickerText - The text that flows by in the status bar when the notification first activates.
when - The time to show in the time field. In the System.currentTimeMillis timebase.
1. In MainActivity.java file, Declare a Notification object named myNotification.
Notification myNotification = null;
2. In the onCreate method, Declare and Set a drawable to an integer variable. The drawable named myicon should be saved to an integer variable named myIcon. This is the icon to put in the status bar.
3. Declare and Set a String variable. Name the variable myFlowText and set it to "You have a new notification!" This is the text that flows by in the status bar when the notification first activates.
String myFlowText = "You have a new notification!";
4. Get the Current Time in Milliseconds and save it to a Long Variable named myTime. This is the time that displays in the time field in the notification.
long myTime;
myTime = System.currentTimeMillis();
5. In the onCreate method, add the below line. This will set a drawable named myIcon, notification text named myFlowText, and a time named myTime to the notification named myNotification.
myNotification = new Notification(myIcon, myFlowText, myTime);
6. Compile and run!
Resources:
http://developer.android.com/reference/android/app/Notification.html#Notification(int, java.lang.CharSequence, long)