How to get the date that the user put in the calendar?

Asked

Viewed 1,356 times

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?

  • the Datepicker Widget.

  • You have already set up the layout with the DatePicker?

  • Yes already, but not much so do not understand very well yet date on android..

  • When inflating the layout, just recover the widget instance and use the API’s DatePicker to recover the selected date, in case only use the DatePicker.getCalendarView().getDate()) and build an Object Calendar 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.

  • Okay, more like I’d send a notification two days before the date ?

  • This can be done using the AlarmManager. You can register a Intent for a given time/day, where a BroadcastReceiver your will be notified. There are several settings that can be made, just take a deep look at the API’s AlarmManager.

  • Beauty I’ll try there thanks!

Show 3 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.