title: Date Not changing while using Data picker
body: <p>I have a Two Textviews and Two Buttons in my Layout, I want to click the button to popup the data picker and choose the date finally all set to be particular textviews.</p>
  
  <p>E.g</p>
  
  <p>Button1 choose date set to Textview1
  Button2 chhose date set to textview2</p>
  
  <p>but the problem is first time working correctly but if i try 2nd time try to change the button1 but value set to Textview2.</p>
  
  <p>first time only working   good.Plz guide me i am leaner step by step sorry for basic question.</p>
  
  <pre><code>// display current date
      public void setCurrentDateOnView() {
  
          tvDisplayDate = (TextView) findViewById(R.id.tvDate);
          tvDisplayDate2 = (TextView) findViewById(R.id.tvDate2);
  
          final Calendar c = Calendar.getInstance();
          year = c.get(Calendar.YEAR);
          month = c.get(Calendar.MONTH);
          day = c.get(Calendar.DAY_OF_MONTH);
  
          // set current date into textview
          tvDisplayDate.setText(new StringBuilder()
                  // Month is 0 based, just add 1
                  .append(month + 1).append("-").append(day).append("-")
                  .append(year).append(" "));
  
          tvDisplayDate2.setText(tvDisplayDate.getText().toString());
      }
  
      public void addListenerOnButton() {
  
          btnChangeDate = (Button) findViewById(R.id.btnChangeDate);
  
          btnChangeDate.setOnClickListener(new View.OnClickListener() {
  
              @Override
              public void onClick(View v) {
  
                  showDialog(DATE_DIALOG_ID);
  
              }
  
          });
          btnChangeDate2 = (Button) findViewById(R.id.btnChangeDate2);
  
          btnChangeDate2.setOnClickListener(new View.OnClickListener() {
  
              @Override
              public void onClick(View v) {
  
                  showDialog(DATE_DIALOG_ID2);
  
  
              }
  
          });
  
      }
  
      protected Dialog onCreateDialog(int id) {
          switch (id) {
  
              case DATE_DIALOG_ID:
                  System.out.println("onCreateDialog  : " + id);
                  cur = DATE_DIALOG_ID;
                  // set date picker as current date
                  return new DatePickerDialog(this, datePickerListener, year, month,
                          day);
              case DATE_DIALOG_ID2:
                  cur = DATE_DIALOG_ID2;
                  System.out.println("onCreateDialog2  : " + id);
                  // set date picker as current date
                  return new DatePickerDialog(this, datePickerListener, year, month,
                          day);
  
          }
          return null;
      }
  
  
      private 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) {
  
              year = selectedYear;
              month = selectedMonth;
              day = selectedDay;
  
              if (cur == DATE_DIALOG_ID) {
                  // set selected date into textview
                  tvDisplayDate.setText(new StringBuilder().append(month + 1)
                          .append("-").append(day).append("-").append(year)
                          .append(" "));
                  System.out.println("A");
                  System.out.println(cur);
              }
  
              if (cur == DATE_DIALOG_ID2){
                  tvDisplayDate2.setText(new StringBuilder().append(month + 1)
                          .append("-").append(day).append("-").append(year)
                          .append(" "));
                  System.out.println("B");
                  System.out.println(cur);
              }
  
          }
      };
  </code></pre>
  
  <blockquote>
    <p>showDialog(); Deprecated message </p>
    
    <p>onCreateDialog Deprecated message </p>
    
    <p>showDialog() parameter does not change at the time of click </p>
  </blockquote>