0
如何在点击通知栏上的图像后指定活动? 我该如何制作意图? 谢谢。Android按下通知时如何进行意图活动
public class AlarmService extends BroadcastReceiver {
NotificationManager nm;
@Override
public void onReceive(Context context, Intent intent) {
nm = (NotificationManager) context
.getSystemService(Context.NOTIFICATION_SERVICE);
CharSequence from = "Check your fridge";
CharSequence message = "It's time to eat!";
PendingIntent contentIntent = PendingIntent.getActivity(context, 0,
new Intent(), 0);
Notification notif = new Notification(R.drawable.fridge_icon3,
"Keep Fridge", System.currentTimeMillis());
notif.setLatestEventInfo(context, from, message, contentIntent);
notif.defaults |= Notification.DEFAULT_SOUND;
notif.flags |= Notification.FLAG_AUTO_CANCEL;
nm.notify(1, notif);
}
}
谢谢您的指导。我把这样\t \t的PendingIntent contentIntent = PendingIntent.getActivity(上下文,0, \t \t \t \t新意图(上下文,KeepFridgeActivity.class),0);不管怎样,谢谢! – wholee1 2011-12-22 09:12:52
同样的问题发生在我和你的解决方案工作.. :-)干杯! – YuDroid 2012-11-10 10:07:36