Last active
February 17, 2020 15:12
-
-
Save januprasad/98441b058578d4d190c6159272502249 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TimePickerFragment : DialogFragment() { | |
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | |
// Use the current time as the default values for the picker | |
val calendar: Calendar = Calendar.getInstance() | |
val hour = calendar.get(Calendar.HOUR) | |
val minute = calendar.get(Calendar.MINUTE) | |
/** Create a new instance of TimePickerDialog and return it | |
* && implement OnTimeSetListener on Activity.**/ | |
return TimePickerDialog( | |
activity, | |
activity as TimePickerDialog.OnTimeSetListener, | |
hour, | |
minute, | |
true) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment