Jing Rajeev
Jing Rajeev

Reputation: 33

Notification in Android before the specified date

I created a notification assume "My Exams".

i want to show reminder notification 3 days before the set date

i'm storing date in database want to compare it with current date and display notification

Any Help will be appreciated

Thank You...

Upvotes: 1

Views: 831

Answers (1)

David Wasser
David Wasser

Reputation: 95636

To generate a date that is 3 days prior to a specific date try this:

Calendar c = Calendar.getInstance();
c.set(year, month, day); // Set the calendar NOTE: this will not change the hour, minute, second
c.add(Calendar.DAY_OF_YEAR, -3); // Roll the calendar back 3 days

Upvotes: 2

Related Questions