NotificationManager notiManage = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); notiManage.notify(1, noti);noti哪来,请看:
Notification noti = new Notification(); noti.icon = R.drawable.ic_launcher; noti.tickerText = "This is test!"; noti.when = System.currentTimeMillis(); //这里是显示时:分,如22:43 noti.setLatestEventInfo(this, noti.tickerText, "AAA", pendingIntent); //将以上东西setView到Notification上去,要不然显示什么呀注:pendingIntent是个PendingIntent,看名字就知道,延迟的activity,指定义某一时间出现的Intent,当然你也可以设置为null。
Intent intent = new Intent(this, MainActivity.class); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0,intent, 0);我的博客其它文章列表