0
對不起,我的英語。我想如果單擊textView打開對話框並設置時間(24小時),但我無法獲得價值。 Log.e輸出什麼StartTimePicker設置時間(android)
time.setOnClickListener(new OnClickListener() {
@SuppressLint("NewApi") @Override
public void onClick(View v) {
DialogFragment dialogFragment = new StartTimePicker();
dialogFragment.show(getFragmentManager(), "start_t_picker");
}
});
//code
@SuppressLint("NewApi")
class StartTimePicker extends DialogFragment implements OnTimeSetListener{
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
TimePickerDialog dialog = new TimePickerDialog(Send.this, null, hour, min, true);
return dialog;
}
@Override
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
Log.e("time is", String.valueOf(hourOfDay) + ":" + String.valueOf(minute));
}
}
感謝狀,但不工作( – mzb86604
uuupppssss,它的工作,謝謝! – mzb86604