0
I’m making a program in which you need the user to put the date of their commitment, and what happens my application will send a notification to him two days before the commitment so that the user remembers his commitment.
First of all i was wondering how do I get the calendar in the java class.
Afterward how do I get the date the user put in the calendar.
And if possible you could try to show me how I do for the app to check the date and when it is two days before it passes a notification.
Thank you!
When you say calendar would be the Widget
DatePicker
(http://developer.android.com/guide/topics/ui/controls/pickers.html) or Calendar application?– Wakim
the Datepicker Widget.
– Dibai
You have already set up the layout with the
DatePicker
?– Wakim
Yes already, but not much so do not understand very well yet date on android..
– Dibai
When inflating the layout, just recover the widget instance and use the API’s
DatePicker
to recover the selected date, in case only use theDatePicker.getCalendarView().getDate())
and build an ObjectCalendar
Java with this return to handle the date. The date on Android uses the same Java data API. The question is perhaps to differentiate the widget that is the graphical API of Android, from the Date/Calendar objects that is the Java API.– Wakim
Okay, more like I’d send a notification two days before the date ?
– Dibai
This can be done using the
AlarmManager
. You can register aIntent
for a given time/day, where aBroadcastReceiver
your will be notified. There are several settings that can be made, just take a deep look at the API’sAlarmManager
.– Wakim
Beauty I’ll try there thanks!
– Dibai