How to change TimePickerDialog theme in Android

Jyotishgher Astrology
By -
1
TimePickerDialog theme in Android







Calendar mcurrentTime = Calendar.getInstance();
int hour = mcurrentTime.get(Calendar.HOUR_OF_DAY);
int minute = mcurrentTime.get(Calendar.MINUTE);
TimePickerDialog mTimePicker;
mTimePicker = new TimePickerDialog(pay2AstrologerMainActivity.this,
AlertDialog.THEME_DEVICE_DEFAULT_DARK, new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker timePicker, int selectedHour, int selectedMinute) {
String status = "AM";

if(selectedHour > 11)
{
// If the hour is greater than or equal to 12
// Then the current AM PM status is PM
status = "PM";
}

// Initialize a new variable to hold 12 hour format hour value
int hour_of_12_hour_format;

if(selectedHour > 11){

// If the hour is greater than or equal to 12
// Then we subtract 12 from the hour to make it 12 hour format time
hour_of_12_hour_format = selectedHour - 12;
}
else {
hour_of_12_hour_format = selectedHour;
}



t_bot.setText(hour_of_12_hour_format + ":" + selectedMinute+ " : " + status);
}
}, hour, minute, true);//Yes 24 hour time
mTimePicker.setTitle("Select Time");
mTimePicker.show();


Post a Comment

1Comments

  1. How to get from Slot Machines in a Casino - JTM Hub
    A slot machine in a casino is 양주 출장안마 one 부천 출장샵 of 익산 출장샵 the most popular ways to get to Vegas. With 문경 출장샵 over 200 고양 출장안마 slot machines and many other table games, it is no

    ReplyDelete
Post a Comment