title: Edittext field enable and disable using button in Android
body: <p>I am working on an Android application in which I want to make my edittext enable and disable by using a "EDIT" button. I am making something like if I press the button it will enable edittexts and if I again press EDIT button then it will disable EditTexts.</p>
  
  <p>My code snippet is given below. In following condition on first attempt it works fine, but after clicking again it just return "click1".</p>
  
  <pre><code>editText.setOnClickListener(new View.OnClickListener() {
  
              @Override
              public void onClick(View v) {
                  if (clickCount == 0){
                      Toast.makeText(getApplicationContext(), "click0", Toast.LENGTH_SHORT).show();
                      fName.setEnabled(true); 
                      lName.setEnabled(true); 
                      mailText.setEnabled(true);  
                      mobileText.setEnabled(true);    
                  }
                  clickCount = 1;
  
  
    Toast.makeText(getApplicationContext(), "click1", Toast.LENGTH_SHORT).show();
          fName.setEnabled(false);
          lName.setEnabled(false);
          mailText.setEnabled(false);
          mobileText.setEnabled(false);
              }
          });
  </code></pre>