Android how to intent activity when notification is pressed?

The code you have posted already has an intent in it e.g. You have new Intent() in the contentIntent. It is not much use as you have not filled it in with anything. You need somthing like this.

Up vote 0 down vote favorite share g+ share fb share tw.

Thanks. 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); } } android notifications android-intent link|improve this question edited Dec 21 '11 at 16:09skaffman114k8136227 asked Dec 21 '11 at 16:07wholee11327 72% accept rate.

The code you have posted already has an intent in it e.g. You have new Intent() in the contentIntent. It is not much use as you have not filled it in with anything. You need somthing like this.

Intent notificationIntent = new Intent(this, MyAvtivity. Class); // modify the intent as nessasary here. PendingIntent contentIntent = PendingIntent.

GetActivity(this, 0, notificationIntent, 0); User Guide here.

Thank you for your guiding. I put like this PendingIntent contentIntent = PendingIntent. GetActivity(context, 0, new Intent(context, KeepFridgeActivity.

Class), 0); anyway, thanks! – wholee1 Dec 22 '11 at 9:12.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions