3
I made a TimePickerDialog
, but I can’t get him to start the current time, always calls 00:00. I’d like to know where I’m going wrong.
Code:
private void chamarTimePickerDialog() {
TimePickerDialog.OnTimeSetListener mTimeSetListener = new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker view, int hora, int minuto) {
Toast.makeText(getActivity(), hora+ ":" + minuto, Toast.LENGTH_SHORT).show();
capHora.setText(hora+ ":" +minuto);
Calendar calNow = Calendar.getInstance();
calNow.setTimeInMillis(System.currentTimeMillis());
calNow.set(Calendar.HOUR_OF_DAY, hora);
calNow.set(Calendar.MINUTE, minuto);
}
};
TimePickerDialog dialog = new TimePickerDialog(getActivity(), mTimeSetListener,0, 0, true);
dialog.show();
}
Lari, I changed the title of your question to make it easier for you to find it. Take advantage and make a tour also to learn more about the site.
– gato
thank you cat! rs
– Lari Souza