I'm using a TimePickerDialog
in my application, I use a hint
for the EditText (through which time is set), but once the user sets time in the TimePickerDialog the hint goes away and the time selected replaces it.
I want the present time (hour and minute) to be displayed in the EditText before the user sets the time, How can I do that?
I added the following code to my project and it worked:
SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm", Locale.getDefault());
String time = timeFormat.format(Calendar.getInstance().getTime());
editText.setText(time);