How to show or set datepicker dialog for a textview that is inside a fragment in Android?
<p>I am absolute beginner to Android. I am trying to set text for text field inside inside a fragment using datepicker dialog.</p>

<p>This is the fragment of text field inside an activity</p>

<pre><code>public class CreateTaskFragment extends Fragment{
    private Button saveBtn;
    private EditText tfDescription,tfDate;
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.create_task,container,false);

        tfDescription = (EditText)view.findViewById(R.id.tf_task_description);
        tfDate = (EditText)view.findViewById(R.id.tf_task_date);
        tfDate.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                DialogFragment pickerFragment = new SelectDateFragment();
                pickerFragment.show(getFragmentManager(),"DatePicker");
            }
        });

        saveBtn = (Button)view.findViewById(R.id.btn_save_task);
        saveBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                saveTask();
            }
        });

        return view;
    }

    public void saveTask()
    {
        String description = tfDescription.getText().toString();
        String date = tfDate.getText().toString();
    }
}
</code></pre>

<p>This is the dialog fragment for picker</p>

<pre><code>public class SelectDateFragment extends DialogFragment implements DatePickerDialog.OnDateSetListener {

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        final Calendar calendar = Calendar.getInstance();
        int yy = calendar.get(Calendar.YEAR);
        int mm = calendar.get(Calendar.MONTH);
        int dd = calendar.get(Calendar.DAY_OF_MONTH);
        return new DatePickerDialog(getActivity(), this, yy, mm, dd);
    }

    public void onDateSet(DatePicker view, int yy, int mm, int dd) {
        populateSetDate(yy, mm+1, dd);
    }
    public void populateSetDate(int year, int month, int day) {
        //set the date here

    }

}
</code></pre>

<p>My question is how to set the selected date for the text field of the previous fragment. Datepicker is working and I do not know how to set selected date for edit text.</p>