Android TimePickerDialog - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android TimePickerDialog class.

This code example shows how to use the following methods:setTitle, setCancelable, show
			this.cv.put(this.getKey(), this.v.getTimeInMillis());
			if (this.ul != null) {
				this.ul.onUpdateValue(this);
			} 
			if (this.dt) {
				TimePickerDialog tpd = new TimePickerDialog(this.getContext(), this,
						this.v.get(Calendar.HOUR_OF_DAY), this.v.get(Calendar.MINUTE), true);
				tpd.setTitle(this.getTitle());
				tpd.setCancelable(true);
				tpd.show();
			} 
		} 
	} 
 
	@Override 
	public void onTimeSet(final TimePicker view, final int hourOfDay, final int minute) {
		this.v.set(Calendar.HOUR_OF_DAY, hourOfDay);
		this.v.set(Calendar.MINUTE, minute);
		this.cv.put(this.getKey(), this.v.getTimeInMillis());
		if (this.ul != null) {
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
                          dateAndTime.get(Calendar.DAY_OF_MONTH))
      .show();
  } 
   
  public void chooseTime(View v) {
    new TimePickerDialog(ChronoDemo.this, t,
                          dateAndTime.get(Calendar.HOUR_OF_DAY),
                          dateAndTime.get(Calendar.MINUTE),
                          true) 
      .show();
  } 
   
  private void updateLabel() { 
    dateAndTimeLabel
      .setText(DateUtils
                 .formatDateTime(this,
                                 dateAndTime.getTimeInMillis(),
                                 DateUtils.FORMAT_SHOW_DATE|DateUtils.FORMAT_SHOW_TIME));
  } 
   
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:show
            hour = value / 60;
            minutes = value % 60;
        } 
 
        Context context = getContext();
        TimePickerDialog dlg = new TimePickerDialog(context,
        new TimePickerDialog.OnTimeSetListener() {
            @Override 
            public void onTimeSet(TimePicker v, int hours, int minutes) {
                int time = hours * 60 + minutes;
                if (key == DIALOG_START_TIME) {
                    mStartTime = time;
                    mStartTimeText.setText(returnTime(time));
                } else { 
                    mEndTime = time;
                    mEndTimeText.setText(returnTime(time));
                } 
                callChangeListener(this);
            }; 
        }, hour, minutes, DateFormat.is24HourFormat(context));

6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setTitle, setCancelable, setCanceledOnTouchOutside
		 minuto = args.getInt("minuto");
	} 
 
	 @Override 
	 public Dialog onCreateDialog(Bundle savedInstanceState) {
		 TimePickerDialog d = new TimePickerDialog(getActivity(), ontimeSet, hora, minuto, true);
		 d.setTitle("Seleccione Horario");
		 d.setCancelable(true);
		 d.setCanceledOnTouchOutside(true);
		 return d;
	 } 
}  
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
                FrameLayout.LayoutParams.WRAP_CONTENT, Gravity.CENTER));
        b.setText("Show dialog");
        b.setOnClickListener(new View.OnClickListener() {
            @Override 
            public void onClick(View v) {
                new TimePickerDialog(TimeDialogActivity.this, null, 12, 12, true).show();
            } 
        }); 
        layout.addView(b);
         
        setContentView(layout);
    } 
} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
 
    @Override 
    protected Dialog onCreateDialog(int id) {
        switch (id) {
            case TIME_DIALOG_ID:
                return new TimePickerDialog(this,
                        mTimeSetListener, mHour, mMinute, false);
            case DATE_DIALOG_ID:
                return new DatePickerDialog(this,
                            mDateSetListener,
                            mYear, mMonth, mDay);
        } 
        return null; 
    } 
 
    @Override 
    protected void onPrepareDialog(int id, Dialog dialog) {
        switch (id) {
            case TIME_DIALOG_ID:
                ((TimePickerDialog) dialog).updateTime(mHour, mMinute);
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setButton, setCancelable
		int hour = c.get( Calendar.HOUR_OF_DAY );
		int minute = c.get( Calendar.MINUTE );
		/** Opening the TimePickerDialog window */ 
 
		 
		tp = new TimePickerDialog( getActivity(), this, hour, minute, DateFormat.is24HourFormat(getActivity()) );
		tp.setCancelable( true );
		 
		tp.setButton( DialogInterface.BUTTON_NEGATIVE, "Cancel",
				new DialogInterface.OnClickListener()
					{ 
 
						public void onClick( DialogInterface dialog, int which )
							{ 
 
							if ( which == DialogInterface.BUTTON_NEGATIVE )
								{ 
								 
								tp.cancel();
								} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setMessage, show
				} 
			} 
		}; 
 
		// 時刻設定ダイアログの作成 
		timePickerDialog = new TimePickerDialog(this, TimeSetListener,
				hourOfDay, minute, is24HourView);
		// timePickerDialog.setTitle("時間設定"); 
		timePickerDialog.setMessage(settitle);
		timePickerDialog.show();
	}; 
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
			timeButton.setText(timeFormatter.format(date));
	} 
 
	public void onClick(View v) {
		if (v == timeButton)
			new TimePickerDialog(activity, this, date.getHours(),
					date.getMinutes(), Preferences.is24HourFormat(activity))
					.show();
		else 
			new DatePickerDialog(activity, this, 1900 + date.getYear(),
					date.getMonth(), date.getDate()).show();
	} 
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
        final Calendar c = Calendar.getInstance();
        int hour = c.get(Calendar.HOUR_OF_DAY);
        int minute = c.get(Calendar.MINUTE);
 
        // TimePickerDialogを生成して返す 
        return new TimePickerDialog(getActivity(), this, hour, minute, is24HourView);
    } 
 
    public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
        // 時刻が選択された時に呼び出される 
        String text = String.format("%d:%d", hourOfDay, minute);
        Toast.makeText(getActivity(), text, Toast.LENGTH_SHORT).show();
    } 
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related Android TimePickerDialog Questions & Answers:

Other Android TimePickerDialog Examples

10:	
11:	        // Create a new instance of TimePickerDialog and return it
12:	        return new TimePickerDialog(getActivity(), this, hour, minute,
13:	                DateFormat.is24HourFormat(getActivity()));
14:	    }

Read More

See Code Examples for Android TimePickerDialog Methods: