title: android.text.Editable android.widget.EditText.getText()' on a null object reference
body: <p>i got some problem in my code .I try to use android studio to create a app that can let user log in , but when i run my php file , it just show <strong>{"success":false}</strong> in a webpage .Next , in the android studio logcat alsoshow some error and my app crash . What is the wrong?</p>
  
  <p>error in Login.php:</p>
  
  <p><strong>{"success":false}</strong></p>
  
  <p>error in app:</p>
  
  <p><strong>FATAL EXCEPTION: main</strong></p>
  
  <p><strong>Process: com.example.user.loginregister, PID: 2304</strong></p>
  
  <p><strong>java.lang.NullPointerException: Attempt to invoke virtual method 'android.text.Editable android.widget.EditText.getText()' on a null object reference</strong></p>
  
  <p>Login.php file:      </p>
  
  <pre><code>  &lt;?php
  $con = new mysqli("xxx","xxx","xxx","xxx");
  
  $username = $_POST["username"];
  $password = $_POST["password"];
  
  $statement = mysqli_prepare($con, "SELECT * FROM user WHERE username = ? AND password =?");
  mysqli_stmt_bind_param($statement, "ss", $username, $password);
  mysqli_stmt_execute($statement);
  
  mysqli_stmt_store_result($statement);
  mysqli_stmt_bind_result($statement, $user_id, $name, $username, $password);
  
  $response = array();
  $response["success"] = false;
  
  while(mysqli_stmt_fetch($statement)){
      $response["success"] = true;
      $response["name"] = $name;
      $response["username"] = $username;
      $response["password"] = $password;
  
  }
  
  echo json_encode($response);
  
  ?&gt;
  </code></pre>
  
  <p>LoginRequest.java</p>
  
  <pre><code>   public class LoginRequest extends StringRequest{
  private static final String LOGIN_REQUEST_URL = "http://finalproject.16mb.com/android/Login.php" ;
  private Map&lt;String , String&gt; params;
  
  public LoginRequest( String username ,String password, Response.Listener&lt;String&gt; listener){
      super(Request.Method.POST, LOGIN_REQUEST_URL, listener, null);
      params = new HashMap&lt;&gt;();
      params.put("username", username);
      params.put("password", password);
  }
  @Override
  public Map&lt;String, String&gt; getParams() {
      return params;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>LoginActivity.java</p>
  
  <pre><code> public class LoginActivity extends AppCompatActivity {
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_login);
  
      final EditText etUsername = (EditText) findViewById(R.id.etUsername);
      final EditText etPassword = (EditText) findViewById(R.id.etPassword);
  
      final Button bLogin = (Button) findViewById(R.id.bLogin);
      final TextView registerLink = (TextView) findViewById(R.id.tvRegisterHere);
  
      registerLink.setOnClickListener(new View.OnClickListener(){
          @Override
          public void onClick(View v) {
              Intent registerIntent = new Intent(LoginActivity.this, RegisterActivity.class);
              LoginActivity.this.startActivity(registerIntent);
          }
      });
  
      bLogin.setOnClickListener(new View.OnClickListener(){
          @Override
          public void onClick(View v) {
              final String username = etUsername.getText().toString();
              final String password = etPassword.getText().toString();
  
             Response.Listener&lt;String&gt; responseListener = new Response.Listener&lt;String&gt;(){
  
                  @Override
                  public void onResponse(String response) {
                      try {
                          JSONObject jsonResponse = new JSONObject(response);
                          boolean success = jsonResponse.getBoolean("success");
  
                          if(success){
                              String name= jsonResponse.getString("name");
  
                              Intent intent = new Intent(LoginActivity.this, UserAreaActivity.class);
                              intent.putExtra("name", name);
                              intent.putExtra("username", username);
  
                              LoginActivity.this.startActivity(intent);
  
  
                          }else{
                              AlertDialog.Builder builder = new AlertDialog.Builder(LoginActivity.this);
                              builder.setMessage("Login Failed")
                                      .setNegativeButton("Retry", null)
                                      .create()
                                      .show();
                          }
                      } catch (JSONException e){
                          e.printStackTrace();
                      }
                  }
  
              };
  
              LoginRequest loginRequest = new LoginRequest(username, password, responseListener);
              RequestQueue queue = Volley.newRequestQueue(LoginActivity.this);
              queue.add(loginRequest);
          }
      });
  }
   }
  </code></pre>