Code example for DatePickerDialog

0
        int year = c.get(Calendar.YEAR);
        int month = c.get(Calendar.MONTH);
        int day = c.get(Calendar.DAY_OF_MONTH);
 
        // DatePickerDialogを生成して返す 
        return new DatePickerDialog(getActivity(), this, year, month, day);
    } 
 
    public void onDateSet(DatePicker view, int year, int month, int day) {
        // 日付が選択された時に呼び出される 
        String text = String.format("%d-%d-%d", year, month + 1, day);
        Toast.makeText(getActivity(), text, Toast.LENGTH_SHORT).show();
    } 
} 
Experience pair programming with AI  Get Codota for Java