I have a TimePickerDialog configured in my project and it is working correctly.
When choosing the time, I have the following option - PM or AM.
Code:
privatevoidtimePicker(){//GetCurrentTimefinalCalendarc=Calendar.getInstance();mHour=c.get(Calendar.HOUR_OF_DAY);mMinute=c.get(Calendar.MINUTE);//LaunchTimePickerDialogTimePickerDialogtimePickerDialog=newTimePickerDialog(this,newTimePickerDialog.OnTimeSetListener(){@OverridepublicvoidonTimeSet(TimePickerview,inthourOfDay,intminute){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();
}
It works right.
Would it be any simpler way or how often is this feature used to SIMPLIFY or make it more explicit to the user if he wants to choose a time before midday or after?