想要在发布通知后在状态栏中显示通知

时间:2011-05-10 05:04:53

标签: android

我想在发布用户通知后在状态栏中显示通知。我该怎么办?

2 个答案:

答案 0 :(得分:1)

状态栏中的通知......

final NotificationManager mgr = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
    Notification note = new Notification(R.drawable.msg,"New Message",System.currentTimeMillis());
    PendingIntent i = PendingIntent.getActivity(this, 0, new Intent(this,notification.class), 0);
    note.setLatestEventInfo(this,"NewMessage","You Receive "+count+" New Message", i);

    mgr.notify(Notify,note);

答案 1 :(得分:0)