title: How the detect the "edittext" box whether it is nothing in Android?
body: <p>I want to program a function that the toast exist when there is nothing 
  in the "edittext" box (id / password), but it dosen't work. </p>
  
  <pre><code>import android.app.Activity;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.Button;
  import android.content.Intent;
  import android.widget.EditText; 
  import android.widget.Toast; 
  import android.view.View.OnClickListener; 
  import android.text.Editable; 
  
  public class Test extends Activity
  {
  
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
      Button button1 = (Button) findViewById(R.id.button1);
      EditText id = (EditText) findViewById(R.id.id);
      EditText pwd = (EditText) findViewById(R.id.pwd);
      Editable Str_id;
      Editable Str_pwd;
      Str_id = id.getText();
      Str_pwd = pwd.getText();
  
  
  
      button1.setOnClickListener(new Button.OnClickListener()
      {
  
        public void onClick(View v){
          if(Str_id==null || Str_pwd == null){
          Toast.makeText(Test.this, "Please Enter User ID / Password", Toast.LENGTH_LONG).show();
  
       }
      });
      }
  
  
  
    }
  </code></pre>