码迷,mamicode.com
首页 > 其他好文 > 详细

37、

时间:2014-09-27 18:25:10      阅读:223      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   io   ar   strong   sp   div   art   

 

 

 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();

 

37、

标签:style   blog   color   io   ar   strong   sp   div   art   

原文地址:http://www.cnblogs.com/androidsj/p/3996512.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!