Dismissing and deleting an alarm
<p>I want to dismiss an alarm and also delete an alarm in 2 different Activities.What functions would I use for both? <code>alarmmanager.cancel()</code> dismisses or deletes the alarm?</p>

<p>I have written this code: </p>

<pre><code>Button DeleteButton = (Button) this.findViewById(R.id.dismiss_button);
    DeleteButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            // Build Intent and Pending Intent to Set Snooze Alarm
            Intent AlarmIntent = new Intent(AlarmActivity.this,
                    AlarmReceiver.class);
            AlarmManager AlmMgr = (AlarmManager) getSystemService(ALARM_SERVICE);
            PendingIntent Sender = PendingIntent.getBroadcast(
                    AlarmActivity.this, 0, AlarmIntent, 0);
            AlmMgr.cancel(Sender);
            finish();

        }

    });
</code></pre>

<p>The app is crashing when I run this.
Can anyone kindly help?</p>
