public AlertDialog show(Context context) { dialog = new AlertDialog.Builder(context).create(); dialog.show(); Window window = dialog.getWindow(); window.setContentView(R.layout.dialog_date_time); window.setGravity(Gravity.CENTER);// 此处可以设置dialog显示的位置 //window.setWindowAnimations(R.style.in_left_out_right_style); window.setBackgroundDrawableResource(R.color.transparent); datePicker = (DatePicker) window .findViewById(R.id.date_time_datePicker1); datePicker.setCalendarViewShown(false); timePicker = (TimePicker) window.findViewById(R.id.date_time_timePicker); but_ok = (Button) window.findViewById(R.id.date_time_but_ok); but_ok.setOnClickListener(this); return dialog; }
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { DatePickerDialog dialog = new DatePickerDialog(getActivity(), R.style.CustomDatePickerDialogTheme, this, mParent.mYear, mParent.mMonth, 1); DatePicker datePicker = dialog.getDatePicker(); // Limit range. Calendar c = mParent.getCalendar(); datePicker.setMinDate(c.getTimeInMillis()); c.set(Calendar.YEAR, mParent.mYear + CC_EXP_YEARS_COUNT - 1); datePicker.setMaxDate(c.getTimeInMillis()); // Remove day. datePicker.findViewById(getResources().getIdentifier("day", "id", "android")) .setVisibility(View.GONE); return dialog; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_select_date); datePicker = (DatePicker) findViewById(R.id.datePicker); date = datePicker.getDayOfMonth(); month = datePicker.getMonth() +1 ; year = datePicker.getYear(); Log.d("date",date+" "+month+" "+year); next = (Button) findViewById(R.id.next); next.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { date = datePicker.getDayOfMonth(); month = datePicker.getMonth() + 1; year = datePicker.getYear(); Log.d("date",date+" "+month+" "+year); Intent i = new Intent(getApplicationContext(),Message.class); startActivity(i); } }); }
private void showDateDialog(final TextView textView) { Calendar calendar = Calendar.getInstance(); int year = calendar.get(Calendar.YEAR); int month = calendar.get(Calendar.MONTH); int day = calendar.get(Calendar.DAY_OF_MONTH); DatePickerDialog dialog = new DatePickerDialog(this, new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker datePicker, int i, int i1, int i2) { // birthday = new Date(i,i1,i2); Date date = new Date(i - 1900, i1, i2); textView.setText(formatDate(date)); } }, year, month, day); dialog.show(); }
/** for the date selected * @param datePicker : the widget object for selecting a date * @param year : the year chosen * @param month : the month chosen * @param day : the day chosen * see: DatePickerFragment */ @Override public void onDateSet(DatePicker datePicker, int year, int month, int day) { final Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, year); calendar.set(Calendar.MONTH, month); calendar.set(Calendar.DAY_OF_MONTH, day); Date date = calendar.getTime(); Date currentDate = new Date(); // Prevent the event's date from being a date in the future if (currentDate.before(date)) date = currentDate; eventDate = date; setDateText(); }
@Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_energy_use_bill, container, false); this.radioButtonFromDate = (RadioButton) view.findViewById(R.id.radioButtonFromDate); this.radioButtonToDate = (RadioButton) view.findViewById(R.id.radioButtonToDate); this.editKwhCost = (EditText) view.findViewById(R.id.editKwhCost); this.datePicker = (DatePicker) view.findViewById(R.id.datePicker); this.toolbar = (Toolbar) view.findViewById(R.id.toolbar); this.setTextRadioButtonDate(radioButtonFromDate, this.fromDate); this.setTextRadioButtonDate(radioButtonToDate, this.toDate); this.setCalendarView(); this.editKwhCost.setText(OhaHelper.getEditable(this.kwhCost)); this.radioButtonFromDate.setOnClickListener(this); this.radioButtonToDate.setOnClickListener(this); this.datePicker.setOnClickListener(this); //Remover o date_picker_header do datePicker se o mesmo existir View viewDayDatePicker = datePicker.findViewById(Resources.getSystem().getIdentifier("date_picker_header", "id", "android")); if (viewDayDatePicker != null) { viewDayDatePicker.setVisibility(View.GONE); } this.toolbar.inflateMenu(R.menu.fragment_energy_use_bill); this.toolbar.setOnMenuItemClickListener(this); return view; }
/** * 隐藏DatePicker中的日期显示 * * @param mDatePicker */ private void hidDay(DatePicker mDatePicker) { Field[] datePickerfFields = mDatePicker.getClass().getDeclaredFields(); for (Field datePickerField : datePickerfFields) { if ("mDaySpinner".equals(datePickerField.getName())) { datePickerField.setAccessible(true); Object dayPicker = new Object(); try { dayPicker = datePickerField.get(mDatePicker); } catch (Exception e) { mPromise.reject("-1", e); } ((View) dayPicker).setVisibility(View.GONE); } } }
/** * 显示时间窗口 * * @param textView */ public static void DateDialog(final Context mContext, final TextView textView) { LayoutInflater inflater = LayoutInflater.from(mContext); View v = inflater.inflate(R.layout.date_picker, null); final DatePicker dataPicker = (DatePicker) v.findViewById(R.id.datePicker); Calendar c = Calendar.getInstance(); mYear = c.get(Calendar.YEAR); mMonth = c.get(Calendar.MONTH); mDay = c.get(Calendar.DAY_OF_MONTH); dataPicker.init(mYear, mMonth, mDay, (datePicker, year, month, day) -> { mYear = year; mMonth = month; mDay = day; }); new MaterialDialog.Builder(mContext) .customView(v, false) .positiveText(android.R.string.ok) .negativeText(android.R.string.cancel) .onPositive((dialog, which) -> { textView.setText(mYear + "-" + (mMonth + 1) + "-" + mDay); }).show(); }
@OnClick(R.id.time_left_from_date_content) void timeLeftStartDateOnClickBehavior() { DatePickerDialog.OnDateSetListener date = new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { startCalendar.set(Calendar.YEAR, year); startCalendar.set(Calendar.MONTH, monthOfYear); startCalendar.set(Calendar.DAY_OF_MONTH, dayOfMonth); DateFormat sdf = android.text.format.DateFormat.getDateFormat(getBaseContext()); startDateContent.setText(sdf.format(startCalendar.getTime())); setDate1 = true; } }; new DatePickerDialog(this, date, startCalendar.get(Calendar.YEAR), startCalendar.get(Calendar.MONTH), startCalendar.get(Calendar.DAY_OF_MONTH)).show(); }
@OnClick(R.id.time_left_due_date_content) void timeLeftDueDateOnClickBehavior() { DatePickerDialog.OnDateSetListener date = new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { dueCalendar.set(Calendar.YEAR, year); dueCalendar.set(Calendar.MONTH, monthOfYear); dueCalendar.set(Calendar.DAY_OF_MONTH, dayOfMonth); DateFormat sdf = android.text.format.DateFormat.getDateFormat(getBaseContext()); dueDateContent.setText(sdf.format(dueCalendar.getTime())); setDate2 = true; } }; new DatePickerDialog(this, date, dueCalendar.get(Calendar.YEAR), dueCalendar.get(Calendar.MONTH), dueCalendar.get(Calendar.DAY_OF_MONTH)).show(); }
@OnClick(R.id.task_due_date_content) void taskDueDateOnClickBehavior() { DatePickerDialog.OnDateSetListener date = new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { dueCalendar.set(Calendar.YEAR, year); dueCalendar.set(Calendar.MONTH, monthOfYear); dueCalendar.set(Calendar.DAY_OF_MONTH, dayOfMonth); DateFormat sdf = android.text.format.DateFormat.getDateFormat(getBaseContext()); dueDateContent.setText(sdf.format(dueCalendar.getTime())); setDate = true; } }; new DatePickerDialog(this, date, dueCalendar.get(Calendar.YEAR), dueCalendar.get(Calendar.MONTH), dueCalendar.get(Calendar.DAY_OF_MONTH)).show(); }
@OnClick(R.id.habit_calendar_year_month) void habitCalendarYearMonthOnClickBehavior() { DatePickerDialog.OnDateSetListener dateListener = new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { selectedCalendar.set(Calendar.YEAR, year); selectedCalendar.set(Calendar.MONTH, monthOfYear); selectedCalendar.set(Calendar.DAY_OF_MONTH, dayOfMonth); habitCalendarView.setCurrentDate(selectedCalendar.getTime()); updateHabitCalendarYearMonth(); updateHabitDetails(selectedCalendar.getTime()); } }; new DatePickerDialog(this.getContext(), dateListener, selectedCalendar.get(Calendar.YEAR), selectedCalendar.get(Calendar.MONTH), selectedCalendar.get(Calendar.DAY_OF_MONTH)).show(); }
/** * 弹出日期选择对话框 * <p> * 参数: * title: 标题 * datetime: 指定日期 yyyy-MM-dd * 返回: * date: 格式:yyyy-MM-dd */ public static void pickDate(final IQuickFragment webLoader, WebView wv, JSONObject param, final Callback callback) { final String title = param.optString("title"); String date = param.optString("datetime"); final Calendar calendar = Calendar.getInstance(); if (!TextUtils.isEmpty(date)) { calendar.setTime(DateUtil.convertString2Date(date, "yyyy-MM-dd")); } wv.post(new Runnable() { public void run() { DialogUtil.pickDate(webLoader.getPageControl().getActivity(), title, calendar, new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { calendar.set(Calendar.YEAR, year); calendar.set(Calendar.MONTH, monthOfYear); calendar.set(Calendar.DAY_OF_MONTH, dayOfMonth); String chooseDate = DateUtil.convertDate(calendar.getTime(), "yyyy-MM-dd"); Map<String, Object> map = new HashMap<>(); map.put("date", chooseDate); callback.applySuccess(map); } }); } }); }
/** * 弹出年月选择对话框 * <p> * 参数: * title: 标题 * datetime: 指定日期 yyyy-MM * 返回: * month: 格式:yyyy-MM */ public static void pickMonth(final IQuickFragment webLoader, WebView wv, JSONObject param, final Callback callback) { String title = param.optString("title"); String date = param.optString("datetime"); final Calendar calendar = Calendar.getInstance(); if (!TextUtils.isEmpty(date)) { calendar.setTime(DateUtil.convertString2Date(date, "yyyy-MM")); } DialogUtil.pickMonth(webLoader.getPageControl().getActivity(), title, calendar, new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { calendar.set(Calendar.YEAR, year); calendar.set(Calendar.MONTH, monthOfYear); calendar.set(Calendar.DAY_OF_MONTH, dayOfMonth); String chooseDate = DateUtil.convertDate(calendar.getTime(), "yyyy-MM"); Map<String, Object> map = new HashMap<>(); map.put("month", chooseDate); callback.applySuccess(map); } }); }
@NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { // Uses the current date as the default date in the picker Calendar c = Calendar.getInstance(); int year = c.get(Calendar.YEAR); int month = c.get(Calendar.MONTH); int day = c.get(Calendar.DAY_OF_MONTH); DatePickerDialog dialog = new DatePickerDialog(getActivity(), this, year, month, day); DatePicker datePicker = dialog.getDatePicker(); datePicker.setCalendarViewShown(false); numOfCalls = 0; return dialog; }
/** * Method to display the date picker */ public void showDatePicker(){ Calendar mCalendar = Calendar.getInstance(); int year = mCalendar.get(Calendar.YEAR); mCalendar.set(Calendar.ERA,1); int month = mCalendar.get(Calendar.MONTH); int day = mCalendar.get(Calendar.DAY_OF_MONTH); mCurrentDatePicker = new DatePickerDialog(mActivity,mDatePickerHandler, year, month, day); mCurrentDatePicker.setButton(DatePickerDialog.BUTTON_POSITIVE, mActivity.getString(R.string.ok),new DialogInterface.OnClickListener(){ @Override public void onClick(DialogInterface dialog, int which) { DatePicker datePicker = mCurrentDatePicker.getDatePicker(); mDatePickerHandler.onDateSet(datePicker, datePicker.getYear(), datePicker.getMonth(), datePicker.getDayOfMonth()); } }); mCurrentDatePicker.show(); }
@Override public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) { String tag = getTag(); MainActivity activity = (MainActivity) getActivity(); // threeten's LocalDate months are zero-indexed. month++; switch (tag) { case "start_date_picker": activity.set_start_date(year, month, dayOfMonth); DialogFragment end_date_fragment = new DatePickerFragment(); end_date_fragment.show(getFragmentManager(), "end_date_picker"); break; case "end_date_picker": activity.set_end_date(year, month, dayOfMonth); activity.generate_potd_list(); break; } }
/** * Called on activity start. Generates layout and button functionality. * @param savedInstanceState */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_new_habit_event); Toolbar toolbar = (Toolbar) findViewById(R.id.actionbar); toolbar.setTitle("New Habit Event"); toolbar.setNavigationIcon(R.drawable.ic_close_button); setSupportActionBar(toolbar); editPhoto = (ImageView) findViewById(R.id.editPhoto); editComment = (EditText) findViewById(R.id.editComment); editDate = (DatePicker) findViewById(R.id.editDate); photoEncoded = ""; editPhoto.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { dispatchTakePictureIntent(); } }); }
@Test public void testShiftRepeaterTaskToTomorrow() { DateTime tomorrow = DateTime.now().withTimeAtStartOfDay().plusDays(1); defaultSetUp(); openAgenda(); onListItem(2).perform(swipeRight()); onListItem(2).onChildView(withId(R.id.item_menu_schedule_btn)).perform(click()); onView(withId(R.id.dialog_timestamp_date_picker)).perform(click()); onView(withClassName(equalTo(DatePicker.class.getName()))) .perform(PickerActions.setDate( tomorrow.getYear(), tomorrow.getMonthOfYear(), tomorrow.getDayOfMonth())); onView(withText(R.string.ok)).perform(click()); onView(withText(R.string.set)).perform(click()); onView(allOf(withId(android.R.id.list), isDisplayed())).check(matches(listViewItemCount(21))); }
@OnClick(R.id.btn_choose_date_dialog) public void onBtnChooseDateDialogClicked() { final Calendar calendar = Calendar.getInstance(); DatePickerDialog dialog = new DatePickerDialog( this, new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) { calendar.set(Calendar.YEAR, year); calendar.set(Calendar.MONTH, month); calendar.set(Calendar.DAY_OF_MONTH, dayOfMonth); String date = DateFormat.getDateInstance(DateFormat.FULL).format(calendar.getTime()); ToastUtils.showShortToast(date); } }, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH)); dialog.show(); }
@OnClick(R.id.button_min_date) void onMinClicked() { showDatePickerDialog(this, widget.getMinimumDate(), new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { widget.state().edit() .setMinimumDate(CalendarDay.from(year, monthOfYear, dayOfMonth)) .commit(); } }); }
/** * Create a native date picker from layout file with spinner mode * @param reactContext * @return Native date picker */ @Override protected DatePicker createViewInstance(ThemedReactContext reactContext) { View view = LayoutInflater.from(reactContext).inflate(R.layout.date_picker, null, false); DatePicker picker = (DatePicker) view.findViewById(R.id.datepicker); ViewGroup viewParent = (ViewGroup) picker.getParent(); if (viewParent != null) { viewParent.removeView(picker); } return picker; }
@OnClick(R.id.button_selected_date) void onSelectedClicked() { showDatePickerDialog(this, widget.getSelectedDate(), new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { widget.setSelectedDate(CalendarDay.from(year, monthOfYear, dayOfMonth)); } }); }
@Override public void onCreate(Bundle savedInstance){ super.onCreate(savedInstance); ((App)getActivity().getApplication()).getComponent().inject(this); taskList = presenter.getNormalTasks(); DatePicker picker = new DatePicker(getActivity()); timeInMillSecs = picker.getMaxDate(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_date_selection); Bundle extras = getIntent().getExtras(); setTitle(extras.getInt("title")); //noinspection ConstantConditions getSupportActionBar().setBackgroundDrawable(new ColorDrawable(ContextCompat.getColor(this, extras.getInt("color")))); dtpDate = (DatePicker) findViewById(R.id.datePicker); dateSelection = GregorianCalendar.getInstance(); dateSelection.setTimeInMillis(extras.getLong("date")); dtpDate.updateDate(dateSelection.get(Calendar.YEAR), dateSelection.get(Calendar.MONTH), dateSelection.get(Calendar.DAY_OF_MONTH)); }
@Override public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) { Calendar calendar = Calendar.getInstance(); calendar.set(year, month, dayOfMonth, 0, 0, 0); DateFormat dateFormat = android.text.format.DateFormat.getDateFormat(activity.getApplicationContext()); String formattedDate = dateFormat.format(calendar.getTime()); medicineDueDate.setText(formattedDate); medicineForUpdate.setDueDate(calendar.getTime()); }
public void showDatePickerDialog() { final Calendar calendar = Calendar.getInstance(); int mYear = calendar.get(Calendar.YEAR); int mMonth = calendar.get(Calendar.MONTH); int mDay = calendar.get(Calendar.DAY_OF_MONTH); final SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MMM dd, yyyy", Locale.US); final SimpleDateFormat simpleDayFormat = new SimpleDateFormat("EEE", Locale.US); final String currentDate = simpleDateFormat.format(calendar.getTime()); final ToodooDatePickerDialog datePickerDialog = new ToodooDatePickerDialog(this, new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker datePicker, int year, int month, int day) { Calendar newCalendar = Calendar.getInstance(); newCalendar.set(year, month, day); selectedDueDateValue = newCalendar.getTime(); String selectedDate = simpleDateFormat.format(selectedDueDateValue); selectedDueDate = simpleDayFormat.format(selectedDueDateValue) + ", " + selectedDate; calendar.add(Calendar.DATE, 1); if (selectedDate.equals(currentDate)) { selectedDueDate = "Today, " + selectedDate; } else if (selectedDate.equals(simpleDateFormat.format(calendar.getTime()))) { selectedDueDate = "Tomorrow, " + selectedDate; } ToodooOptionsModel ToodooOptionsModel = toodooOptionsList.get(1); ToodooOptionsModel.setOptionValue(selectedDueDate); mAdapter.notifyDataSetChanged(); } }, mYear, mMonth, mDay); datePickerDialog.getDatePicker().setMinDate(System.currentTimeMillis() - 1000); setTitle("Select a date"); datePickerDialog.show(); }
/** * Callback from date dialog * * @inheritDoc */ @Override public void onDateSet(DatePicker view, int year, int month, int day) { this.year = year; this.month = month; this.day = day; pickTime(); }
/** * 显示时间捡取器 */ private void showDatePickerDialog() { new DatePickerDialog(getActivity(), new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { showDate.set(Calendar.YEAR, year); showDate.set(Calendar.MONTH, monthOfYear); showDate.set(Calendar.DAY_OF_MONTH, dayOfMonth); bookDateEditText.setText(DateFormat.format("yyyy-MM-dd", showDate)); } }, showDate.get(Calendar.YEAR), showDate.get(Calendar.MONTH), showDate.get(Calendar.DAY_OF_MONTH)).show(); }
public void onDateChanged(DatePicker vw, int year, int monthOfYear, int dayOfMonth) { GregorianCalendar c = getCalendar(); c.set(year, monthOfYear, dayOfMonth, tpTime.getCurrentHour(), tpTime.getCurrentMinute()); this.m_Date = c.getTime(); NotifyDelegate(); }
@Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { myCalendar.set(Calendar.YEAR, year); myCalendar.set(Calendar.MONTH, monthOfYear); myCalendar.set(Calendar.DAY_OF_MONTH, dayOfMonth); moodEvent.setDate(SIMPLE_DATE_FORMAT.format(myCalendar.getTime())); new TimePickerDialog(EditMoodActivity.this, time, myCalendar .get(Calendar.HOUR_OF_DAY), myCalendar.get(Calendar.MINUTE), false).show(); }
private void openTimePicker() { MyDatePickerDialog datePickerDialog = new MyDatePickerDialog(this, new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { birthYear = year; birthMonth = monthOfYear; birthDay = dayOfMonth; updateDate(); } }, birthYear, birthMonth, birthDay); datePickerDialog.show(); }
@Override public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) { if (mActiveCal != null) { mActiveCal.set(Calendar.YEAR, year); mActiveCal.set(Calendar.MONTH, month); mActiveCal.set(Calendar.DAY_OF_MONTH, dayOfMonth); onUpdateDate(mViewId, mActiveCal); onAfterShowDatePicker(); } }
@Override public void onDateSet(DatePicker datePicker, int year, int month, int day, int id_view) { Calendar cal = Calendar.getInstance(); cal.set(Calendar.YEAR, year); cal.set(Calendar.MONTH, month); cal.set(Calendar.DAY_OF_MONTH, day); DateTimeHelper.clearTime(cal); onUpdateDate(id_view, cal); }
public void showDialogDatePicker(){ AlertDialog.Builder builder = new AlertDialog.Builder(context, R.style.DialogTransBackGround); final AlertDialog dialog_date = builder.create(); dialog_date.show(); View view_dialog = LayoutInflater.from(context).inflate(R.layout.item_dialog_datepicker, null); dialog_date.setContentView(view_dialog); DatePicker picker = (DatePicker) view_dialog.findViewById(R.id.date_picker); Button bt_yes = (Button) view_dialog.findViewById(R.id.bt_yes); Button bt_no = (Button) view_dialog.findViewById(R.id.bt_no); Calendar calendar = Calendar.getInstance(); int int_Year = calendar.get(Calendar.YEAR); int int_Month = calendar.get(Calendar.MONTH); int int_Day = calendar.get(Calendar.DAY_OF_MONTH); time = int_Year + "-" + String.format("%02d", (int_Month + 1)) + "-" + String.format("%02d", int_Day); picker.init(int_Year, int_Month, int_Day, new DatePicker.OnDateChangedListener() { @Override public void onDateChanged(DatePicker datePicker, int i, int i1, int i2) { Log.e("aaa", "" + i2); time = i + "-" + String.format("%02d", (i1 + 1)) + "-" + String.format("%02d", i2); } }); bt_yes.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { et_add_time.setText(time); dialog_date.dismiss(); } }); bt_no.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { dialog_date.dismiss(); } }); }
@Override public void onDateSet(DatePicker datePicker, int year, int month, int day) { yearFinal = year; monthFinal = month + 1; dayFinal = day; hour = editDate_copy.getHours(); minute = editDate_copy.getMinutes(); TimePickerDialog timePickerDialog = new TimePickerDialog(EditMoodActivity.this, EditMoodActivity.this, hour, minute, DateFormat.is24HourFormat(this)); timePickerDialog.show(); }
@Override public void onDateSet(DatePicker view, int year, int monthofYear, int dayOfMonth) { dateTime.set(Calendar.YEAR,year); dateTime.set(Calendar.MONTH,monthofYear); dateTime.set(Calendar.DAY_OF_MONTH,dayOfMonth); updateDeadLineText(); updateTime(); }