private final int NOTIFICATION_ID = 0x123;
// 创建Notification
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
Intent in = new Intent(NotificationActivity.this, TabHostActivity.class);
PendingIntent pi = PendingIntent.getActivity(NotificationActivity.this, 0, in, 0);Notification notification = new Notification.Builder(this)
.setAutoCancel(true).setTicker("新的通知").setSmallIcon(R.drawable.t)
.setContentTitle("新消息").setContentText("啦啦啦啦")
.setWhen(System.currentTimeMillis()).setContentIntent(pi).build();
notificationManager.notify(NOTIFICATION_ID, notification);
// 取消Notification
notificationManager.cancel(NOTIFICATION_ID);