关于一个程序中多个Notification的精确控制
2011-03-18 14:33
225 查看
Problem:
When a notification is selected, Tabs activity is called passing the intent. I want to access the unique notificationId of the notification that was selected in Tabs. I tried intent.putExtra() to save the notificationId in the intent. But, for multiple notifications its overwriting the notificationId and returns the latest one. I dont understand as to why this is happening and how can i avoid this overwriting of notificationId.
Answer:
I got the answer. The intents were getting cached in. To, make a new intent, just add the following piece of code:
This makes the intent unique.
Also, someone suggested me the following piece of code to make the intent unique:
It didnt help me, but might be of help to someone else.
When a notification is selected, Tabs activity is called passing the intent. I want to access the unique notificationId of the notification that was selected in Tabs. I tried intent.putExtra() to save the notificationId in the intent. But, for multiple notifications its overwriting the notificationId and returns the latest one. I dont understand as to why this is happening and how can i avoid this overwriting of notificationId.
Answer:
I got the answer. The intents were getting cached in. To, make a new intent, just add the following piece of code:
intent.setData((Uri.parse("custom://"+System.currentTimeMillis())));
This makes the intent unique.
Also, someone suggested me the following piece of code to make the intent unique:
intent.setAction("actionstring" + System.currentTimeMillis());
It didnt help me, but might be of help to someone else.
相关文章推荐
- 关于精确控制FPS的程序框架
- 一个可以精确控制FPS的程序框架
- 一个关于FLEX窗口控制的开源COOL程序--VistaFlow
- 一个可以精确控制FPS的程序框架
- 模拟器与程序分析-4-一个简单的周期精确模拟器(CAS)的C语言实现
- 一个关于windows mobile的小程序源代码2(业务逻辑层)
- 一个关于list容器的小程序
- 关于乒乓球比赛的一个java程序题
- 【程序人生】:关于招聘的一个理解
- 菜鸟发问,请各位不吝赐教啊! 关于一个简单的程序的理解问题
- 关于对于一个浮动图片的控制
- 关于windows窗体FORM程序打包成一个安装文件
- 关于派生类的构造的——一个程序的分析(钱能c++ P353),加上了析构函数
- 一个简单关于学生成绩管理的C++程序代码,但是对于拷贝析构函数目前还是不知其作用何在
- 关于java程序的一个小问题,大家可以学习下
- 一个文件操作的简单程序:关于文件的fopen、fread、fseek、ftell、fclose等操作(FIFO related)
- 一个关于字符串统计的程序
- fiddler是程序抓包必备软件之一,分享一个关于fiddler的技术博客
- 一个关于位点的所在位置的程序
- 小程序大问题,MSDN中一个小小示例所带来的疑问,一个关于DataList的一个简单应用