title: Cancel alarmmanager from broadcast receiver using Pending intent
body: <p>I have created a BroadCastReceiver which schedules some events using alarm manager. </p>
  
  <p>In the BroadcastReceiver I am using following code to schedule. </p>
  
  <pre><code>Intent localIntent = new Intent("com.test.sample");
  
          PendingIntent  pi = PendingIntent.getBroadcast(context, 0,
                      localIntent, 0);
              alarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP,
                      SystemClock.elapsedRealtime() + (5 * 60 * 1000),
                      pi);
  </code></pre>
  
  <p>Here <strong>context</strong> comes from the onReceive method of the receiver.</p>
  
  <p>I want to cancel this alarm on receive of other broadcast. 
  I am aware that alarm can be cancelled by  <code>alarmManager.cancel(pi);</code></p>
  
  <p><strong>However if the alarmanager was set from any other activity that how to get hold of PendingIntent to cancel it?</strong></p>
  
  <p>Thanks</p>