title: In Android, how to make Login button disable with respect to EditText?
body: <p>If <code>EditText</code> is empty then Login <code>Button</code> has to be disabled. And if <code>EditText</code> has some texts then Login <code>Button</code> has to be enabled. Well you can see this method on Instagram Login.</p>
  
  <p>Both fields are empty, Sign in <code>Button</code> is DISABLED.</p>
  
  <p><img src="https://i.stack.imgur.com/dtFq7.png" alt="enter image description here"></p>
  
  <p>Here Password field is empty, so still Sign in<code>Button</code> is DISABLED.</p>
  
  <p><img src="https://i.stack.imgur.com/W5suU.png" alt="enter image description here"></p>
  
  <p>Here both Username and Password field is not empty, So Sign in<code>Button</code> is ENABLED.</p>
  
  <p><img src="https://i.stack.imgur.com/SccL7.png" alt="enter image description here"></p>
  
  <p>how to achieve these steps??
  here is my code and it doesn't work..</p>
  
  <pre><code>EditText et1,et2;
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_login_check);
      et1 = (EditText) findViewById(R.id.editText1);
      et2 = (EditText) findViewById(R.id.editText2);
      Button b = (Button) findViewById(R.id.button1);
  
      String s1 = et1.getText().toString();
      String s2 = et2.getText().toString();
  
      if(s1.equals("")|| s2.equals("")){
          b.setEnabled(false);
      } else {
          b.setEnabled(true);
      }
  }
  </code></pre>