How Can I Get The Context Of Other Activity?
I'm working on the alarm app, and have trouble removing an existing alarm. I have to create the same pending intent to remove the alarm in the activity which lists all alarms in my
Solution 1:
This has nothing to do with contexts. The intent you schedule was created with getActivity. That is a different kind of intent than the one created with getBroadcast. You cannot use the latter to cancel the former.
(Edited to add code)
Intentintent=newIntent(
getApplicationContext(),
PushMainActivity.class);
PendingIntentpendingIntent= PendingIntent.getActivity(
ListAddActivity.this,
ALARM_CODE,
intent,
PendingIntent.FLAG_UPDATE_CURRENT);
alarmManager.cancel(pendingIntent);
Post a Comment for "How Can I Get The Context Of Other Activity?"