Example usage for android.app DatePickerDialog updateDate

List of usage examples for android.app DatePickerDialog updateDate

Introduction

In this page you can find the example usage for android.app DatePickerDialog updateDate.

Prototype

public void updateDate(int year, int month, int dayOfMonth) 

Source Link

Document

Sets the current date.

Usage

From source file:rta.ae.sharekni.RegisterVehicle.java

protected void onPrepareDialog(int id, Dialog dialog) {
    DatePickerDialog datePickerDialog = (DatePickerDialog) dialog;
    // Get the current date
    datePickerDialog.updateDate(year_x, month_x, day_x);
}

From source file:com.cloverstudio.spika.MyProfileActivity.java

@SuppressWarnings("deprecation")
@Override//from w  w  w.  j  a  v  a 2s. co  m
protected void onPrepareDialog(int id, Dialog dialog) {
    super.onPrepareDialog(id, dialog);

    switch (id) {
    case GET_BIRTHDAY_DIALOG:
        DatePickerDialog dateDialog = (DatePickerDialog) dialog;
        int monthOfYear = Calendar.getInstance().get(Calendar.MONTH);
        int dayOfMonth = Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
        int year = Calendar.getInstance().get(Calendar.YEAR);
        dateDialog.updateDate(year, monthOfYear, dayOfMonth);
        break;
    }
}

From source file:rta.ae.sharekni.RegisterNewTest.java

protected void onPrepareDialog(int id, Dialog dialog) {
    if (id == DILOG_ID) {
        DatePickerDialog datePickerDialog = (DatePickerDialog) dialog;
        // Get the current date
        datePickerDialog.updateDate(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH),
                cal.get(Calendar.DAY_OF_MONTH));
    }/*from  ww w  .  ja v a2s . co m*/

}

From source file:dev.memento.MementoBrowser.java

@Override
protected void onPrepareDialog(int id, Dialog dialog) {
    super.onPrepareDialog(id, dialog);

    switch (id) {
    case DIALOG_DATE:
        // To fix a bug described here: http://www.zunisoft.com/?p=1140 
        DatePickerDialog dlg = (DatePickerDialog) dialog;
        DateFormat longDateFormat = new SimpleDateFormat("EEEE, MMMM d, yyyy");
        dlg.setTitle(longDateFormat.format(mDateChosen.getDate()));
        dlg.updateDate(mDateChosen.getYear(), mDateChosen.getMonth() - 1, mDateChosen.getDay());
        break;//from w w  w. j  a v  a 2s.c  o  m
    case DIALOG_ERROR:
        AlertDialog ad = (AlertDialog) dialog;
        ad.setMessage(mErrorMessage);
        mErrorMessage = null;
        break;
    }
}

From source file:org.totschnig.myexpenses.activity.ExpenseEdit.java

@Override
protected Dialog onCreateDialog(int id) {
    switch (id) {
    case DATE_DIALOG_ID:
        boolean brokenSamsungDevice = isBrokenSamsungDevice();
        @SuppressLint("InlinedApi")
        Context context = brokenSamsungDevice ? new ContextThemeWrapper(this,
                MyApplication.getThemeType() == MyApplication.ThemeType.dark ? android.R.style.Theme_Holo_Dialog
                        : android.R.style.Theme_Holo_Light_Dialog)
                : this;
        int year = mCalendar.get(Calendar.YEAR);
        int month = mCalendar.get(Calendar.MONTH);
        int day = mCalendar.get(Calendar.DAY_OF_MONTH);
        DatePickerDialog datePickerDialog = new DatePickerDialog(context, mDateSetListener, year, month, day);
        if (brokenSamsungDevice) {
            datePickerDialog.setTitle("");
            datePickerDialog.updateDate(year, month, day);
        }//from  w w w . j  av  a  2  s.co  m
        return datePickerDialog;
    case TIME_DIALOG_ID:
        return new TimePickerDialog(this, mTimeSetListener, mCalendar.get(Calendar.HOUR_OF_DAY),
                mCalendar.get(Calendar.MINUTE), android.text.format.DateFormat.is24HourFormat(this));
    }
    return null;
}