Here you can find the source of cancelAlarm(Context context, int index, String action)
public static void cancelAlarm(Context context, int index, String action)
//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); } }