public class MyNotificationDemo extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.setContentView(R.layout.main);
NotificationManager notificationManager = (NotificationManager) super
.getSystemService(Activity.NOTIFICATION_SERVICE);
Notification notification = new Notification(R.drawable.a1,
"您的好友", System.currentTimeMillis()); // 立刻发送一个消息
PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
super.getIntent(), PendingIntent.FLAG_UPDATE_CURRENT); // 创建了一个PendingIntent对象
notification.setLatestEventInfo(this, "TJ",
"去哪里吃饭啊", contentIntent);
notificationManager.notify("qq", R.drawable.a1, notification);
}
}