Android Alarm Cancel cancelAlarm(Context context, int index, String action)

Here you can find the source of cancelAlarm(Context context, int index, String action)

Description

cancel Alarm

Declaration

public static void cancelAlarm(Context context, int index, String action) 

Method Source Code

//package com.java2s;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;

public class Main {
    public static void cancelAlarm(Context context, int index, String action) {
        Intent intent = new Intent(action);
        intent.putExtra("index", index);
        PendingIntent sender = PendingIntent.getBroadcast(context, index,
                intent, 0);//from w  w  w .ja v  a 2 s .c om
        AlarmManager am = (AlarmManager) context
                .getSystemService(Context.ALARM_SERVICE);
        am.cancel(sender);
    }
}

Related

  1. cancelAlarm(PendingIntent intent, Context context)
  2. cancelAlarmManager(Context context, PendingIntent pendingIntent)
  3. cancel(Context context, Intent broadcastIntent, int requestCode)
  4. cancelAlarm(Context context, Class clazz, int flags)