首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

关于一个程序中多个Notification的精确统制

2012-09-10 
关于一个程序中多个Notification的精确控制Problem: When a notification is selected, Tabs activity is

关于一个程序中多个Notification的精确控制
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:

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. 

热点排行