如何在android中的通知栏中按下清除按钮时捕获清除事件

时间:2011-02-22 15:33:42

标签: android

HI,  在Android中,当在通知屏幕上按下清除按钮时,我想在我的应用程序中捕获它并做一些事情。请帮我解决这个问题。

2 个答案:

答案 0 :(得分:1)

Notification添加deleteIntent

答案 1 :(得分:0)

在我的代码中我已经有了contentIntent,现在添加了deleteintent后,当我按下clear按钮时,内容会被执行。 Intent noti = new Intent(context,MyService.class); noti.putExtra(“key1”,true); contentIntent = PendingIntent.getService(context,0,noti,0); Intent stopIntent = new Intent(context,Myervice.class);  notificationIntent.putExtra(“Key2”,true); PendingIntent deleteIntent = PendingIntent.getService(context,0,stopIntent,0);  现在,当我按下清除键时,我得到了key1和key 2