title: Not able to update TextView's text in custom dialog box
body: <p>Please help. I have tried everything but failed every time. I am building an android app where I need to update text of a TextView in dialog box programmatically.
  This dialog box is created using a custom layout. Posting code below, Please help in updating value of tv1 to "It's the new text". In XML layout file text was set to "old text".
  After I run this program, the value of tv1 in 'dialogabt', is still seen as "old text".</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          Button b1 = (Button) findViewById(R.id.b1);
  
          //generating first dialog box 
          b1.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                  Dialog dialog1 = new Dialog(MainActivity.this);
                  dialog1.requestWindowFeature(Window.FEATURE_NO_TITLE);
                  dialog1.setContentView(R.layout.setings);
                  dialog1.show();
              }
          });
      }
  }
  </code></pre>
  
  <p>function to generate the second dialog box and update TextView's text in it</p>
  
  <pre><code>public void abtit(View view) {
      Dialog dialogabt = new Dialog(this);
      dialogabt.requestWindowFeature(Window.FEATURE_NO_TITLE);
  
      LayoutInflater inflater = this.getLayoutInflater();
      View dialogView = inflater.inflate(R.layout.custom2, null);
      TextView tv1 = (TextView) dialogView.findViewById(R.id.firstapp);
  
      System.out.println("Going to set new value");
      tv1.setText("Its new text");
      System.out.println("done setting new value");
  
      dialogabt.setContentView(R.layout.custom2);
      dialogabt.show();
  }
  </code></pre>
  
  <p><strong>settings.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="300dp"
      android:layout_height="wrap_content"
      android:orientation="vertical"&gt;
  
      &lt;TextView
          android:id="@+id/set3"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:gravity="center"
          android:onClick="abtit"
          android:text="About app" /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p><strong>custom2.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="315dp"
      android:layout_height="wrap_content"
      android:layout_gravity="center"
      android:background="@drawable/custom_alert2"
      android:orientation="vertical"&gt;
  
      &lt;TextView
          android:id="@+id/firstapp"
          android:layout_width="wrap_content"
          android:layout_height="100dp"
          android:onClick="openapp2"
          android:text="old text" /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>