androiddatapicker

I want to take the date from DatePicker


Well I am doing an app that has one activity and another class called MyPicker that extends DialogFragment and implements DatePickerDialog.OnDateSetListener

The thing is when user click in a button a dataPicker appear and I want to take that date from datePicker to a texfield that it is the activity.

How do you recommend I do that?


Solution

  • If you are changing the date in date picker then you can do like this

    datePicker.setOnDateChangeListner(new OnDateChangedListener() {
     public void onDateChanged(DatePicker view, int year1,
    int monthOfYear1, int dayOfMonth1) {
    year = year1;
    monthOfYear = monthOfYear1;
    dayOfMonth = dayOfMonth1;
    }
    }
    );