37、pendingIntent 点击通知栏进入页面

 转载:

http://blog.csdn.net/yuzhiboyi/article/details/8484771

https://my.oschina.net/youranhongcha/blog/196933

 

 1 new Thread() {
 2 
 3             @Override
 4             public void run() {
 5                 // TODO Auto-generated method stub
 6                 super.run();
 7                 NotificationManager manager = (NotificationManager) 
getSystemService(
NOTIFICATION_SERVICE); 9 Notification notification = new Notification(); 10 // 不会被清除 11 notification.flags = Notification.FLAG_NO_CLEAR; 12 notification.icon = R.drawable.main_icon_notification; 13 notification.tickerText = "XXX正在保护您的手机"; 14 // 远程的view 我们的view对象 是要显示在另外一个进程里面 另外一个程序里面 所以就需要一个remote view 15 RemoteViews rv = new RemoteViews(getPackageName(), 16 R.layout.monitor_app); 17 rv.setTextViewText(R.id.textView1, "XXX正在保护您的手机"); 18 rv.setProgressBar(R.id.progressBar1, 100, 0, false); 19 notification.contentView = rv; 20 Intent intent = new Intent(MonitorService.this, 21 SplashActivity.class); 22 PendingIntent pendingIntent = PendingIntent.getActivity( 23 MonitorService.this, 0, intent, 24 Intent.FLAG_ACTIVITY_NEW_TASK); 25 notification.contentIntent = pendingIntent; 26 27 manager.notify(2, notification); 28 } 29 30 }.start();

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值