何らかの理由でタイムピッカーから設定された時間を取得しようとしていますが、それは起こっていません。
私は getCurrentHour と getCurrentMinute() を使用していますが、それらは仕事をしていないようです. clearFocus() を試みましたが、違いはありませんでした.
ボタンクリックで時間を取得しようとしています。関連するコードを以下に添付しました。これ以上表示する必要がある場合はお知らせください。
Button next_button = (Button) findViewById(R.id.next_button);
next_button.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
//Calendar current = Calendar.getInstance();
Calendar cal = Calendar.getInstance();
//time_picker = (TimePicker) findViewById(R.id.time);
// time_picker.clearFocus(); // this did not help
cal.set(
time_picker.getCurrentHour(),
time_picker.getCurrentMinute(),
00);
Toast.makeText(getApplicationContext(),
"set time: "+cal.getTime(),
Toast.LENGTH_LONG).show(); // this is returning the current time
// that gets initialised with
setAlarm(cal);
}
});
私の質問は次のとおりです。TImePickerから時間を取得するにはどうすればよいですか?
時間を割いてこれを読んでくれてありがとう。