title: Get programmatic set EditText value
body: <h1>Edit 4: I did my own numberpicker, so I don't need help with this anymore.</h1>
  
  <h2>But I think the problem is that I didn't use dialog.findViewById()...</h2>
  
  <p>I'm trying to get a <code>EditText</code> value, that is created programmatic. But it don't work, when the <code>onClick</code> function run the code breaks.</p>
  
  <pre><code>button.setOnClickListener(new OnClickListener()
  {
      public void onClick(View v)
      {
          numberValue = (EditText) findViewById(R.id.number_picker_value);
          Log.d("****2**", numberValue.getText().toString());
  
          dialog.dismiss();
      }
   });
  </code></pre>
  
  <p>The value and ID is set from another class, <code>NumberPicker.java</code>. </p>
  
  <pre><code>private void initValueEditText( Context context )
  {
      value = new Integer( 0 );
  
      valueText = new EditText( context );
      valueText.setId(R.id.number_picker_value); //ID set here
      valueText.setTextSize(25);
      ...
      //value set sooner, look in the link for full code.
  }
  </code></pre>
  
  <p>Full source code of NumberPicker.java can be found here <a href="http://pastebin.com/dLRem5Jw" rel="nofollow">here</a>.</p>
  
  <p>The <code>R.id.number_picker_value</code> is defined in an XML file with
  <code>&lt;item type="id" name="number_picker_value" /&gt;</code>.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>What I mean with <em>"the code breaks"</em> is that i get a <code>Force close dialog</code>.</p>
  
  <p><strong>EDIT2:</strong></p>
  
  <p><a href="http://gyazo.com/f0d4a32eb2f0652c3fc9cc9b4cfa2617.png" rel="nofollow">Logcat output.</a> (Is it this you want?)</p>
  
  <p><strong>EDIT3:</strong></p>
  
  <p>Btw, I never call on NumberPicker.java. It start itself when I load the XML file with this bit of code:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;LinearLayout
      xmlns:android           = "http://schemas.android.com/apk/res/android"
      android:layout_width    = "wrap_content"    
      android:layout_height   = "wrap_content"&gt;
  
      &lt;!-- This seem to start NumberPicker.java, so I have no object to refer to. --&gt;
      &lt;com.android.GissaSiffran.NumberPicker
          android:id            = "@+id/numberPickerDialog"
          android:orientation   = "horizontal"
          android:layout_width  = "fill_parent"
          android:layout_height = "fill_parent"
          android:gravity       = "center"&gt;
      &lt;/com.android.GissaSiffran.NumberPicker&gt;
  
          &lt;!--  Canel / ok button --&gt;
      &lt;Button
          android:id = "@+id/cnfrm"
          android:layout_width  = "wrap_content"
          android:layout_height = "wrap_content"
          android:textSize      = "13dp"
          android:textStyle     = "italic"
          android:text          = "@string/cnfrmBtn"&gt;&lt;/Button&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Maybe I do some wrong here?</p>
  
  <p>When I run <code>dialog.setContentView(R.layout.pick_a_number_dialog); dialog.show();</code> the XML loads and the number picker is in the dialog and i can choose number.
  But I have never started the <code>NumberPicker.java</code> with ie <code>NumberPicker np = new NumberPicker(getApplicationContext(), null));</code> maybe I do wrong here? (I'm new to java).</p>
  
  <p><em>Btw my first post here. :)</em></p>