android notification

        Intent intent=new Intent(mainActivity.this,mainActivity.class);
        PendingIntent pi=PendingIntent.getActivity(mainActivity.this, 0, intent, 0);
        Notification myNotification=new Notification();
        myNotification.icon=R.drawable.noti;
        myNotification.tickerText="点击查看";
        myNotification.defaults=Notification.DEFAULT_SOUND;
        myNotification.setLatestEventInfo(mainActivity.this, "示例", "点击查看", pi);
        NotificationManager notificationManager=(NotificationManager) getSystemService(NOTIFICATION_SERVICE);
        notificationManager.notify(0, myNotification);

imageimage

posted @ 2011-04-17 15:57  朱旭东  阅读(303)  评论(0编辑  收藏  举报