0
I have a Timepickerdialog configured in my project and is working properly.
When choosing the time I have the following option - PM or AM.
Code:
private void timePicker(){
// Get Current Time
final Calendar c = Calendar.getInstance();
mHour = c.get(Calendar.HOUR_OF_DAY);
mMinute = c.get(Calendar.MINUTE);
// Launch Time Picker Dialog
TimePickerDialog timePickerDialog = new TimePickerDialog(this,
new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
mHour = hourOfDay;
mMinute = minute;
mHoraString = (hourOfDay + ":" + minute).toString();
mHora.setText(hourOfDay + ":" + minute);
/*milisegundos*/
long horaMil = TimeUnit.HOURS.toMillis(hourOfDay);
long minMil = TimeUnit.MINUTES.toMillis(minute);
long soma_mils = horaMil + minMil;
mHoraMilisegundos = Long.toString(soma_mils);
}
}, mHour, mMinute, false);
timePickerDialog.show();
}
Works just right.
Would it have some simpler way or how is usually used this feature, to SIMPLIFY OR MAKE MORE EXPLICIT if the user wants to choose a time before Noon or After?
Is it mandatory to display am/pm? You cannot display the clock in 24h format?
– Leonardo Lima
Currently I show also in 24horas format. The question is whether it would have any more user-friendly form. @Leonardolima1
– TiagoIB
Currently I show also in 24horas format. The question is whether it would have any more user-friendly form. @Leonardolima1
– TiagoIB