這是Java
[code=java]timePicker = (TimePicker) findViewById(R.id.timePicker1);
text=(TextView) findViewById(R.id.textView1);
timePicker.setOnTimeChangedListener(new TimePicker.OnTimeChangedListener() {
@Override
public void onTimeChanged(TimePicker view, int hourOfDay, int minute) {
// TODO Auto-generated method stub
// Toast.makeText(MainActivity.this, hourOfDay, Toast.LENGTH_LONG).show();
text.setText(hourOfDay);
}[/code]
這是logcat
04-04 17:48:26.787: E/InputEventReceiver(5700): Exception dispatching input event.
看別人帖子這麼用沒問題啊?
你提問時能否告訴一下是哪一行出錯了呢!看別人帖子是沒有用的,可能是不同的版本、或其它原因導致別人可以用,但你不能用。這很正常的!
現在執行的代碼就一句,可以試試這樣寫:
text.setText(Integer.toString(hourOfDay));