In this tutorial we will see about Android TimePicker Dialog ,we will see an example of selecting Time from Timepicker dialog and display it in TextView.This dialog will disable the background activity until the user select the time and click ‘done’ tab of the dialog shown.
Firstly We get the instance of calender class and get the minute and hour of the system and set it to textview.
To construct Dialog we make use "TimePickerDialog" class , A dialog that prompts the user for the time of day using a TimePicker.
" TimePickerDialog (Context context, TimePickerDialog.OnTimeSetListener callBack, int hourOfDay, int minute, boolean is24HourView) "
when the dialog gets prepared the onPrepareDialog(int id, Dialog dialog) is called and it updates the time which is set by user .
Lets See An Example
file :- TimePicker.java