title: Android get text of EditText elements in a dialog
body: <p>I am trying to write data, users put in my review dialog to the database using json.
  Everything works except getting the text of the two fields.. If I hard code 2 string everything is fine and writes as it should.</p>
  
  <p>Here is my code</p>
  
  <pre><code>private void writeReview() {
      EditText ETUsername = (EditText) findViewById(R.id.username);
      String username = ETUsername.getText().toString();
  
      EditText ETMessage = (EditText) findViewById(R.id.dialog_review);
      String message = ETMessage.getText().toString();
  
      Review review = new Review(username, message, retailerId.toString(),
              "8Hr------U");
      JsonHelper jsonHelper = new JsonHelper();
  
      HttpWriter httpWriter = new HttpWriter();
      httpWriter.setJsonObject(jsonHelper.getJsonReview(review));
      httpWriter
  </code></pre>
  
  <p>The dialog --------------------------------</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"&gt;
      &lt;EditText
          android:id="@+id/username"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_marginTop="16dp"
          android:layout_marginLeft="4dp"
          android:layout_marginRight="4dp"
          android:layout_marginBottom="4dp"
          android:hint="@string/dialog_username" /&gt;
      &lt;EditText
          android:id="@+id/dialog_review"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_marginTop="4dp"
          android:layout_marginLeft="4dp"
          android:layout_marginRight="4dp"
          android:layout_marginBottom="16dp"
          android:fontFamily="sans-serif"
          android:hint="@string/dialog_review" /&gt;
  &lt;!--     &lt;SeekBar
          android:id="@+id/seekBar1"
          android:layout_width="300dp"
          android:layout_height="wrap_content"/&gt; --&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Is it maybe because the two fields are into a dialog and the activity cannot reach it like I try to do it?</p>
  
  <p>If you can help me - many thanks and happy holidays.</p>