title: Android getText from EditText return NULL
body: <p>in this simple Application of my first program in Android i want to get <code>username</code> and <code>password</code> from User. but after click on button that return <code>NULL</code> and thats incorrect, <code>username</code> and <code>password</code> fields have string and are not <code>NULL</code>.
  <code>Textusername</code> and <code>Textpassword</code> in this code are <code>NULL</code> and can not get string from <code>R.id.username</code> AND <code>R.id.password</code></p>
  
  <p>My 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:orientation="vertical"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
          &gt;
      &lt;LinearLayout
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:orientation="horizontal"
              &gt;
  
          &lt;TextView
                  android:layout_width="0dp"
                  android:layout_height="40dp"
                  android:layout_weight="1"
                  android:text="@string/EnterUsername"
                  /&gt;
          &lt;EditText
                  android:layout_width="0dp"
                  android:layout_height="40dp"
                  android:layout_weight="1"
                  android:id="@+id/username"
                  /&gt;
      &lt;/LinearLayout&gt;
      &lt;LinearLayout
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:orientation="horizontal"
              &gt;
  
          &lt;TextView
                  android:layout_width="0dp"
                  android:layout_height="40dp"
                  android:layout_weight="1"
                  android:text="@string/EnterPassword"
                  /&gt;
          &lt;EditText
                  android:layout_width="0dp"
                  android:layout_height="40dp"
                  android:layout_weight="1"
                  android:id="@+id/password"
                  /&gt;
      &lt;/LinearLayout&gt;
      &lt;TextView
              android:layout_width="fill_parent"
              android:layout_height="0dp"
              android:layout_weight="1"
              /&gt;
      &lt;Button
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:id="@+id/submitButton"
              android:text="@string/SubmitButton"
              android:gravity="center"
              android:background="@drawable/purple"/&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p><strong>My Code:</strong></p>
  
  <pre><code>package com.example.AndroidMultiPage;
  
  import android.app.Activity;
  import android.content.DialogInterface;
  import android.content.Intent;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.Button;
  import android.widget.EditText;
  import android.widget.Toast;
  
  public class MyActivity extends Activity {
      /**
       * Called when the activity is first created.
       */
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
  
          final EditText username = (EditText) findViewById(R.id.username);
          final EditText password = (EditText) findViewById(R.id.password);
  
          Button   submit   = (Button)   findViewById(R.id.submitButton);
  
          final String Textusername = username.getText().toString();
          final String Textpassword = password.getText().toString();
  
          submit.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                  Toast.makeText(
                           MyActivity.this, Textusername, 
                           Toast.LENGTH_SHORT).show();
  
                  //TOAST SHOW NULL
              }
          });
      }
  }
  </code></pre>