Code example for DialogFragment

Methods: onCreateDialog, getActivity

0
    } 
 
    @Override 
    public Dialog onCreateDialog(Bundle savedInstanceState) {
 
        super.onCreateDialog(savedInstanceState);
 
        if (null != savedInstanceState) {
            mCalendar = (Calendar) savedInstanceState.getSerializable(CALENDAR);
        } 
 
        if (null == mCalendar) {
            mCalendar = Calendar.getInstance();
            mCalendar.setTimeInMillis(System.currentTimeMillis());
        } 
 
        int year = mCalendar.get(Calendar.YEAR);
        int month = mCalendar.get(Calendar.MONTH);
        int day = mCalendar.get(Calendar.DAY_OF_MONTH);
 
        // Create a new instance of DatePickerDialog and return it 
        return new DatePickerDialog(getActivity(), this, year, month, day);
    } 
 
    @Override 
    public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
        mCallback.onDateSet(view, year, monthOfYear, dayOfMonth);
Connect your IDE to all the code out there  Get Codota for Java