Android在特定时间设置TimePickerDialog

时间:2014-05-23 15:03:27

标签: android view time dialog picker

我希望我的TimePickerDialog默认设置为19.00。我怎么能得到这个?

public void ora(View v) {
    Calendar calendar = Calendar.getInstance();

    myDialog = new TimePickerDialog(Promemoria_giornaliero.this, new OnTimeSetListener() {

    @Override
    public void onTimeSet(TimePicker view, int hourOfDay, int minute) {


    txtTime.setText(hourOfDay + ":" + minute);

    }
    }, calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE), true);
    myDialog.show();

    };

1 个答案:

答案 0 :(得分:1)

您目前正在提供calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE)作为默认的小时和分钟。将其替换为19, 0