How to set the date from DatePicker dialog for multiple calls
<p>Good day, can't seem to find a solution for this. i have 2 buttons that when pressed, opens a datepickerdialog, but my problem now is , how can i set them to the appropriate button on OnDateSet method. I am using a DialogFragment for the date and then implementing the DateListener in my activity. I have tried using getTag() but no success in getting the tag. here is what i tried:</p>

<pre><code>public void showfromDatePickerDialog(View v) {
        DialogFragment dateFragment = new DateDialogFragment();
        dateFragment.show(getSupportFragmentManager(), "fromdatePicker");
    }

    public void showtoDatePickerDialog(View v) {
        DialogFragment dateFragment = new DateDialogFragment();
        dateFragment.show(getSupportFragmentManager(), "todatePicker");
    }


        public void onDateSet(DatePicker view, int year, int month, int day) {

        StringBuilder builder = new StringBuilder();
        builder.append(day).append("-")
               .append(month).append("-")
               .append(year);

        String text= builder.toString();

        if(view.getTag().toString().equals("fromdatePicker")) { // error here

            Log.d(TAG, "got here" + text);
            fromdate.setText(text);
        }


        if(view.getTag() == "todatePicker") {
            todate.setText(text);
        }
</code></pre>

<p>any ideas how to implement this? i keep seeing solutions about using 2 different DialogFragment class but am guessing there should be another way. or am i wrong? Thank you</p>
