CreateEventActivity.DatePickerFragment

public static class DatePickerFragment extends DialogFragment implements DatePickerDialog.OnDateSetListener

DatePicker static class that handles operations of the time selection fragment

Methods

getDatePicker

public DatePicker getDatePicker()

Get the DatePicker

Returns:The DatePicker

getDay

public int getDay()

Get the selected day

Returns:The selected day of the month with the first day represented by 1

getMonth

public int getMonth()

Get the selected month

Returns:The selected month as an integer with January as 0 and December as 11

getYear

public int getYear()

Get the selected year

Returns:The selected year (e.g. 2004 returns the integer 2004)

isSet

public boolean isSet()

Check whether the user has set a date

Returns:true if the user has set a date, false otherwise

onCreateDialog

public Dialog onCreateDialog(Bundle savedInstanceState)

Called when the fragment is created Sets the initial state of the calendar to the current date and returns the resulting DatePickerDialog to display

Parameters:
  • savedInstanceState – Last saved state of fragment
Returns:

DatePickerDialog to display to the user

onDateSet

public void onDateSet(DatePicker view, int year, int month, int day)

When user sets the date, show their choice in the eventDate textView

Parameters:
  • view – The date picker shown via the fragment
  • year – Year the user chose
  • month – Month the user chose
  • day – Day the user chose