I'm new on android programming and i'm working on reminder application. now, i've done storing all information including date and time into SQLlite database. my question is how do i match alarm that stored in database with current time on android
Asked
Active
Viewed 1,297 times
2 Answers
1
query the data base compare with calendar
Calendar c = Calendar.getInstance();
c.set(Calendar.MONTH, Calendar.MARCH);
c.set(Calendar.DAY_OF_MONTH, 3);
long time2= c.getTimeInMillis();
c.set(Calendar.MONTH, Calendar.AUGUST);
c.set(Calendar.DAY_OF_MONTH, 8);
long time3= c.getTimeInMillis();
if(time>time2){
//Logic
if(time>time3){
//Logic
}
}

kamal
- 290
- 3
- 20
0
or count down the seconds instead of ever using calender or relative phone time.. did a similar app myself and it seems to reduce variabality due to phone time being off or reset etc...

Delish
- 77
- 1
- 12