查看标题
我不想在main.xml中做任何事情
答案 0 :(得分:0)
正如Mark所说,TimePickerDialog没有任何id 你想创建一个TimePickerDialog ?,这是一个基本的例子::
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//***Create your TimePickerDialog!!!
new TimePickerDialog(this,mTimeSetListener, 12, 12, false).show();
}
private TimePickerDialog.OnTimeSetListener mTimeSetListener=new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
Toast.makeText(GR_Comments.this, "my Time is :: " + hourOfDay + ":" + minute, Toast.LENGTH_LONG).show();
}
};