title: Setting Textview text From static inner class
body: <p>I have two textview. when i click on them they show DateDialogBox.. this runs perfect for me.. I want to set my textview text the selected date.. </p>
  
  <pre><code>public class ApplyLeaveFrag extends Fragment implements OnClickListener {
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
              Bundle savedInstanceState) {
          // TODO Auto-generated method stub
          View view = inflater.inflate(R.layout.apply_leave_fragment, container,
                  false);
  
          TextView FROM = (TextView) view.findViewById(R.id.textView1);
          TextView TO = (TextView) view.findViewById(R.id.textView2);
  
          // I register setOnClickListener() on both of them:
  
          FROM.setOnClickListener(this);
          TO.setOnClickListener(this);
  
          return view;
      }
  
      public void onClick(View v) {
  
          switch (v.getId()) {
  
          case R.id.textView1:
              ShowCal();
              break;
  
          case R.id.textView2:
              ShowCal();
              break;
          }
      }
  
      public void ShowCal() {
          DialogFragment newFragment = new DatePickerFragment();
          newFragment.show(getFragmentManager(), "datePicker");
  
      }
  
      public static class DatePickerFragment extends DialogFragment implements
  
      DatePickerDialog.OnDateSetListener {
  
          @Override
          public Dialog onCreateDialog(Bundle savedInstanceState) {
              // Use the current date as the default date in the picker
              final Calendar c = Calendar.getInstance();
              int year = c.get(Calendar.YEAR);
              int month = c.get(Calendar.MONTH);
              int day = c.get(Calendar.DAY_OF_MONTH);
  
              // Create a new instance of DatePickerDialog and return it
              return new DatePickerDialog(this.getActivity(), this, year, month,
                      day);
          }
  
          public void onDateSet(DatePicker view, int year, int month, int day) {
              // Do something with the date chosen by the user
                          //how can I set From or To's text From here..or any alternative
  
          }
      }
  }
  </code></pre>