Sometimes, we need to capture time from user. If we forced them to type required time then there is chance for mis-typing and also selecting a time is quite easy compare to type.
In android, we can use in built timePicker dialog to capture time from user.
Step 1: Create a new project in Android Studio and name it Android time picker.
Step 2: Open res -> drawable and add a xml resource file with a name
Step 3: Open MainActivity.java and replace its code with below given code.
Step 4:Open res -> drawable -> activity_main.xml and replace the code with code of activity_main.xml with the below given code.activity_main.xml
Step 5:Clean and run your project to see the result.