Disable Button on click

int count = 0;

if (count == 0) {
    stop.setEnabled(false);
    PlayButton.setEnabled(true);
}

@Override
public void onClick(View v) {
    switch(v.getId()) {
        case R.id.play:
            count++;
            play.setEnabled(false);
            Toast.makeText(this, "Button Disabled", Toast.LENGTH_LONG).show();
            Stopbutton.setEnabled(true);
            break;

        case R.id.stop:
            Toast.makeText(this, "Button Disabled", Toast.LENGTH_LONG).show();
            count--;    
            PlayButton.setEnabled(true);
            stop.setEnabled(false);
            break;        
    }
}

& check this link How to disable an Android button?


You can also try:-

for button enable-

button.setClickable(true); 

for button disable-

button.setClickable(false);

in the body of onclick

disable button1 as it get clicked

public void onClick(View v) {
  if(v.getId() == R.id.button1)
   {
       Button btn = (Button)findViewById(R.id.buton1);
       btn.setEnabled(false);

   }

}