comparing input Date & Time with current date & time in android -


i creating "to-do things" app user can create tasks done. in main activity have fragment consists of 3 edittexts ie notification content , date & time of notification.

each new entry added database. database displayed in form of listview in activity.

my questions are-:
q1) want compare date & time of each entry & print come ie date & time after present date & time.so how should perform comparison?

q2) when date & time reached generate notification .

q1) use calendar class. can take calendar object , set date , time user data (using calendar.set) , compare calendar set current time follows:

calendar cal = gregoriancalendar.getinstance(); cal.settimeinmillis(system.currenttimemillis()); 

to compare 2 calendars can use calendar.before method, or can convert them "timeinmillis" , calculate difference in milliseconds.

q2) use thealarmmanager , broadcastreceiver


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -