title: EditText getText returns empty
body: <p>hopefully I am just passing something silly.</p>
  
  <p>PROBLEM: my EditText (2) getText() return empty String "" @ runtime IN THE LISTENER. Please see the lines inside the onClick(...)</p>
  
  <p>I suspect it has to be with how I am inflating searchDialog and setContentView of dialog after create() on the Builder, but can't figure it out.</p>
  
  <p>CODE:</p>
  
  <pre><code>private void initSearch() {
      results = new ArrayList&lt;Photo&gt;();
      AlertDialog.Builder searchDialog = new AlertDialog.Builder(this);
      AlertDialog dialog = searchDialog.create();
      LayoutInflater inflater = this.getLayoutInflater();
      dialog.setContentView(R.layout.search_dialog);
      searchDialog.setView(inflater.inflate(R.layout.search_dialog, null));
      final EditText tagField = (EditText) dialog.findViewById(R.id.tagField);
      final EditText valueField = (EditText) dialog.findViewById(R.id.valueField);
      searchDialog.setTitle("Search Photos");
      searchDialog.setMessage("Specify tag and value...");
      searchDialog.setPositiveButton("Search", new DialogInterface.OnClickListener() {
  
          @Override
    public void onClick(DialogInterface dialog, int which) {
        try { // PROBLEM: first two lines
            String tag = tagField.getText().toString(); // TAG WILL BE EMPTY
      String value = valueField.getText().toString(); // VALUE WILL BE EMPTY
      String criteria = tag+":\""+value+"\"";
      ArrayList&lt;String&gt; tags = new ArrayList&lt;String&gt;();
            tags.add(criteria);
      HomeScreen.results = c.getPhotosByTag(tags);
  
      if(!tag.equalsIgnoreCase("person") || !tag.equalsIgnoreCase("location")){
          throw new IllegalArgumentException("Tag types can only be location or person");
      }else if(results.size() == 0) {
          throw new IllegalArgumentException("No results");
      }else {
          Intent intent = new Intent(HomeScreen.this,SearchResults.class);
          startActivity(intent);
            }
        } catch(Exception e) {
            dialog.dismiss();
      Utilities.createErrorDialog(HomeScreen.this, e.getMessage());
        }
  
          }
       });
      searchDialog.show();
  }
  </code></pre>
  
  <p>And here is the XML:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/search_dialog"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:orientation="vertical" &gt;
      &lt;TextView
          android:id="@+id/tagText" 
          android:padding="7dp"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:textSize="14sp"
          android:text="@string/tag" /&gt;
      &lt;EditText 
          android:id="@+id/tagField"
          android:padding="7dp"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:inputType="text"/&gt;
      &lt;TextView
          android:id="@+id/valueText" 
          android:padding="7dp"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:textSize="14sp"
          android:text="@string/value" /&gt;
      &lt;EditText 
          android:id="@+id/valueField"
          android:padding="7dp"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:inputType="text"/&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Any help will be very much appreciated.</p>