Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void initDateTextView() {
- dateTextView.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- showDialog(DATE_DIALOG_ID);
- }
- });
- }
- @Override
- protected Dialog onCreateDialog(int id) {
- switch (id) {
- case DATE_DIALOG_ID:
- // set date picker as current date
- return new DatePickerDialog(this, datePickerListener,
- this.year, this.month, this.date);
- }
- return null;
- }
- @Override
- protected void onPrepareDialog(int id, Dialog dialog) {
- switch (id) {
- case DATE_DIALOG_ID:
- ((DatePickerDialog)dialog).updateDate(this.year, this.month, this.date);
- }
- }
- private static final int DATE_DIALOG_ID = 0;
- private final DatePickerDialog.OnDateSetListener datePickerListener = new DatePickerDialog.OnDateSetListener() {
- // When dialog box is closed, below method will be called.
- public void onDateSet(DatePicker view, int selectedYear, int selectedMonth, int selectedDay) {
- Log.i("CHEOK", selectedYear + ", " + selectedMonth + ", " + selectedDay);
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement