I want to set and cancel an Alarm for a particular time. I am doing the same using the TimePicker using the following code.

```
public void setRecurringAlarm(int randomTimer,long mills, int i){
        Intent intent = new Intent(CreateAlarmActivity.this, AlarmReceiver.class);
        intent.setData(Uri.parse("timer:" + i));
        PendingIntent pendingIntent = PendingIntent.getBroadcast(CreateAlarmActivity.this, 1253, intent, PendingIntent.FLAG_CANCEL_CURRENT|  Intent.FILL_IN_DATA);
        AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);

        alarmManager.set(AlarmManager.RTC_WAKEUP,mills,
                pendingIntent);
        Toast.makeText(CreateAlarmActivity.this, "Alarm "+i+" isSet", Toast.LENGTH_LONG).show();
    }

```

**Note:**-Suppose I set the alarm for 10:00 PM. It works fine for 10:00 PM. But when I again run the same code (after 10 PM) i.e once the time has been passed on which the alarm has been set and I recall that code (to reset the alarm), it starts running immediately. Why it is so ? I am unable to get where I am a wrong.