title: Disable a button after is has been clicked, android
body: <p>I am trying to disable the button after it is clicked. Th app doesn't crash it just doesn't disable it. wondering could anyone help me out?
  here is the on click method for the button i am trying to disable.</p>
  
  <pre><code> //Submit button for answer
          final Button submit = (Button) findViewById(R.id.submit);
           submit.setOnClickListener(new OnClickListener() {
  
          @Override
          public void onClick(View view) {
              EditText answerA = (EditText) findViewById(R.id.answerA);
  
              String toCompare = answerA.getText().toString();
              TextView score = (TextView)findViewById(R.id.score_text_a);
              scoreKeeper scoremgr = new scoreKeeper();
  
              //anaswer to input
              if(toCompare.matches("Alligator") || toCompare.matches("alligator") ||
              (toCompare.matches("Alligator ") || toCompare.matches("alligator "))) {
  
                  //adds to score if inout matches one of the above
                  scoremgr.addToScore();
                  score.setText("Your score is " +Integer.toString(scoremgr.checkScore()));
  
                  //calls the next letter class
                  Intent intent_b = new Intent(button_a.this, button_b.class);
                  startActivity(intent_b);
  
                  //displays a toast message if correct
                  Toast.makeText(button_a.this, "Well Done, You Got it Right", Toast.LENGTH_SHORT).show();
                  submit.setEnabled(false);
  
              }else{
                  //displays a toast meaasge if wrong
                  Toast.makeText(button_a.this, "Wrong Answer, Try Again", Toast.LENGTH_SHORT).show();
  
              }
          }
      });
  </code></pre>