Created
October 10, 2013 19:02
-
-
Save sakurabird/6923659 to your computer and use it in GitHub Desktop.
android 時刻ダイアログ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void showTimeDialog() { | |
final Calendar calendar = Calendar.getInstance(); | |
final int hour = calendar.get(Calendar.HOUR_OF_DAY); | |
final int minute = calendar.get(Calendar.MINUTE); | |
final TimePickerDialog timePickerDialog = new TimePickerDialog(this, | |
new TimePickerDialog.OnTimeSetListener() { | |
@Override | |
public void onTimeSet(TimePicker view, int hourOfDay, int minute) { | |
Toast.makeText(MainActivity.this, | |
String.valueOf(hourOfDay) + ":" + String.valueOf(minute), | |
Toast.LENGTH_SHORT).show(); | |
} | |
}, hour, minute, true); | |
timePickerDialog.show(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment