Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A simple fragment for displaying a date picker on Android. For use with the new Fragments API
import java.util.Calendar;
import android.app.DatePickerDialog;
import android.app.DatePickerDialog.OnDateSetListener;
import android.app.Dialog;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
public class DatePickerDialogFragment extends DialogFragment {
private OnDateSetListener mDateSetListener;
public DatePickerDialogFragment() {
// nothing to see here, move along
}
public DatePickerDialogFragment(OnDateSetListener callback) {
mDateSetListener = (OnDateSetListener) callback;
}
public Dialog onCreateDialog(Bundle savedInstanceState) {
Calendar cal = Calendar.getInstance();
return new DatePickerDialog(getActivity(),
mDateSetListener, cal.get(Calendar.YEAR),
cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.