Code example for TimePickerDialog

Methods: setMessagesetTitlesetOnCancelListenersetOnDismissListenersetOnShowListenershow

0
 
	private void openTimePickerDialog(boolean is24r) {
		Calendar calendar = Calendar.getInstance();
		timePickerDialog = new TimePickerDialog(MainActivity.this,
				onTimeSetListener, calendar.get(Calendar.HOUR_OF_DAY),
				calendar.get(Calendar.MINUTE), is24r);
		timePickerDialog.setTitle("TimePickerDialog Title");
		timePickerDialog.setMessage("TimePickerDialog Message");
 
		timePickerDialog.setOnShowListener(new OnShowListener() {
 
			@Override 
			public void onShow(DialogInterface arg0) {
				dialogMsg = "OnShow\n";
				info.setText(dialogMsg);
			} 
		}); 
 
		timePickerDialog.setOnCancelListener(new OnCancelListener() {
 
			@Override 
			public void onCancel(DialogInterface dialog) {
				dialogMsg += "OnCancel\n";
				info.setText(dialogMsg);
 
			} 
		}); 
		timePickerDialog.setOnDismissListener(new OnDismissListener() {
 
			@Override 
			public void onDismiss(DialogInterface arg0) {
				dialogMsg += "OnDismiss\n";
				info.setText(dialogMsg);
			} 
		}); 
 
		timePickerDialog.show();
 
	} 
 
	OnTimeSetListener onTimeSetListener = new OnTimeSetListener() {
 
Stop searching for code, let great code find you!  Add Codota to your java IDE