从Service中的Notification启动Activity
来源:互联网 发布:大数据数据分析论文 编辑:程序博客网 时间:2024/05/17 12:03
NotificationManager notificationManager=(NotificationManager) PlayerService.this.getSystemService(NOTIFICATION_SERVICE);int ticon=R.drawable.ticon;//int listPosition=intent.getIntExtra("listPosition", -1);mp3Infos=MediaUtil.getMp3Infos(PlayerService.this);Intent intent1=null;CharSequence tickerText=mp3Infos.get(listPosition).getTitle();CharSequence artistText=mp3Infos.get(listPosition).getArtist();long when =System.currentTimeMillis();Notification notification=new Notification(ticon, tickerText, when);try {intent1=new Intent(Intent.ACTION_MAIN);intent1.addCategory(Intent.CATEGORY_LAUNCHER);intent1.setClass(com.simple.music.service.PlayerService.this, PlayerActivity.class);intent1.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);notification.flags=Notification.FLAG_ONGOING_EVENT;PendingIntent pgi=PendingIntent.getActivity(this, 0, intent1, 0);notification.setLatestEventInfo(this,artistText , tickerText, pgi);notificationManager.notify(1, notification);} catch (Exception e) {// TODO Auto-generated catch blocke.printStackTrace();}
来源:http://blog.csdn.net/xiaoxujie2007_/article/details/7383708
0 0
- 从Service中的Notification启动Activity
- 从Service启动Activity
- android从service里面启动一个Activity
- 从serivce中通过Notification启动一个Activity
- 从serivce中通过Notification启动一个Activity
- 使用一个Notification启动Activity
- 从Service中启动一个Activity需要加Intent.FLAG_ACTIVITY_NEW_TASK
- Service 中启动 Activity
- Service中启动Activity
- Android Service启动Activity
- Service 中启动 Activity
- service 启动 activity
- Android Service启动Activity .
- Service 中启动 Activity
- Service里启动Activity
- 从Notification启动intent导致新建Activity的问题【已解决】
- android 启动另一个app中的activity和service
- Android Studio开发基础之启动Service,并通过从Activity向Service传递数据
- SQL Syntax -- More about SQL
- CUDA编程入门----Thrust库简介
- Sort Colors
- Win764bit上安装32位Oracle10g出现错误:无法定位程序输入点GetProcessImageFileNameW于动态链接库PSAPI.DLL
- 设计模式学习笔记--策略(Strategy)模式
- 从Service中的Notification启动Activity
- 如何恢复手机中删除的微信聊天记录?
- SDOI2014 Round1 day1
- Effective C++——》条款14:在资源管理中小心copying行为
- Python学习笔记(1)变量、循环
- Python学习笔记(2)比特操作、类、文件操作
- golang 日期格式化的意义
- Makefile 中:= ?= += =的区别
- 擅长排列的小明