Example usage for android.app DatePickerDialog DatePickerDialog

List of usage examples for android.app DatePickerDialog DatePickerDialog

Introduction

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

Prototype

public DatePickerDialog(@NonNull Context context, @Nullable OnDateSetListener listener, int year, int month,
        int dayOfMonth) 

Source Link

Document

Creates a new date picker dialog for the specified date using the parent context's default date picker dialog theme.

Usage

From source file:com.ferid.app.classroom.date_time_pickers.DatePickerFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    dateBackListener = (DateBackListener) getActivity();

    // Use the current date as the default date in the picker
    final Calendar c = Calendar.getInstance();
    int year = c.get(Calendar.YEAR);
    int month = c.get(Calendar.MONTH);
    int day = c.get(Calendar.DAY_OF_MONTH);

    // Create a new instance of DatePickerDialog and return it
    return new DatePickerDialog(getActivity(), this, year, month, day);
}

From source file:com.rappsantiago.weighttracker.dialog.DatePickerDialogFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    LocalDate now = new LocalDate();

    int year = now.getYear();
    int monthOfYear = now.getMonthOfYear();
    int dayOfMonth = now.getDayOfMonth();

    Dialog datePickerDialog = new DatePickerDialog(getActivity(), mOnDateSetListener, year, monthOfYear - 1,
            dayOfMonth);//from  w  w w . j  a  v a2s . co  m
    Util.hideSoftKeyboard(getContext(), getActivity().getCurrentFocus());

    return datePickerDialog;
}

From source file:in.darbose.classroom.date_time_pickers.DatePickerFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    backNavigationListener = (BackNavigationListener) getActivity();

    // Use the current date as the default date in the picker
    final Calendar c = Calendar.getInstance();
    int year = c.get(Calendar.YEAR);
    int month = c.get(Calendar.MONTH);
    int day = c.get(Calendar.DAY_OF_MONTH);

    // Create a new instance of DatePickerDialog and return it
    return new DatePickerDialog(getActivity(), this, year, month, day);
}

From source file:org.hancel.adapters.customUi.DatePickerFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    // Use the current date as the default date in the picker
    final Calendar c = Calendar.getInstance();
    int year = c.get(Calendar.YEAR);
    int month = c.get(Calendar.MONTH);
    int day = c.get(Calendar.DAY_OF_MONTH);

    // Create a new instance of DatePickerDialog and return it
    DatePickerDialog dt = new DatePickerDialog(getActivity(), (TrackDialog) getActivity(), year, month, day);
    dt.setButton(DialogInterface.BUTTON_POSITIVE, "OK", (TrackDialog) getActivity());
    dt.setOnCancelListener((TrackDialog) getActivity());
    return dt;//w ww . ja va2 s. com
}

From source file:com.google.adsensequickstart.DatePickerFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    // Is it "from" or "to" date?.
    Bundle args = getArguments();/*from   w  w w  .j  av a 2  s .c o m*/
    isFrom = args.getBoolean("isFrom");

    // Use the current date as the default date in the picker.
    final Calendar c = Calendar.getInstance();
    int year = c.get(Calendar.YEAR);
    int month = c.get(Calendar.MONTH);
    int day = c.get(Calendar.DAY_OF_MONTH);

    // Create a new instance of DatePickerDialog and return it.
    return new DatePickerDialog(getActivity(), this, year, month, day);
}

From source file:de.dreier.mytargets.features.settings.DatePreferenceDialogFragmentCompat.java

@NonNull
@Override//  w w w.j a v a 2  s. co m
public Dialog onCreateDialog(Bundle savedInstanceState) {
    DatePreference pref = (DatePreference) getPreference();
    return new DatePickerDialog(getContext(), this, pref.date.getYear(), pref.date.getMonthOfYear() - 1,
            pref.date.getDayOfMonth());
}

From source file:com.saulcintero.moveon.ui.widgets.myDatePickerDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    DatePickerDialog dp = new DatePickerDialog(getActivity(), ondateSet, year, month, day);
    dp.setTitle(title);/*w w w  . j  a  v a  2  s.  c o m*/
    return dp;
}

From source file:fr.jcf.pret.fragments.DatePickerFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    // On affiche la date courante pour initialiser la date
    final Calendar c = Calendar.getInstance();
    int year = c.get(Calendar.YEAR);
    int month = c.get(Calendar.MONTH);
    int day = c.get(Calendar.DAY_OF_MONTH);

    // On instancie un nouveau composant DatePicherDialog pour affichage
    return new DatePickerDialog(getActivity(), this, year, month, day);
}

From source file:de.dreier.mytargets.features.training.edit.DatePickerFragment.java

@NonNull
@Override// w w w.ja v a2  s .  c  o m
public Dialog onCreateDialog(Bundle savedInstanceState) {
    // Use the current date as the default date in the picker
    LocalDate date = (LocalDate) getArguments().getSerializable(ARG_CURRENT_DATE);
    Assert.assertNotNull(date);

    // Create a new instance of DatePickerDialog and return it
    DatePickerDialog.OnDateSetListener listener = (DatePickerDialog.OnDateSetListener) getTargetFragment();
    return new DatePickerDialog(getActivity(), listener, date.getYear(), date.getMonthOfYear() - 1,
            date.getDayOfMonth());
}

From source file:com.enadein.carlogbook.ui.DatePickerFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

    int year = c.get(Calendar.YEAR);
    int month = c.get(Calendar.MONTH);
    int day = c.get(Calendar.DAY_OF_MONTH);

    return new DatePickerDialog(getActivity(), listener, year, month, day);
}