I need to hide a button during an onClick action like this:
public void onClick(View view) {
switch (view.getId()){
case R.id.button1:
Button button2 = (Button) findViewById(R.id.button2);
button2.setVisibility(View.GONE);
//Some methods
//...
button2.setVisibility(View.VISIBLE);
break;
}
But the visibility changes only after the onClick, what could I do to hide the button during the onClick?
Thanks
You may try like below:
of course because you are executing all operation in the same thread you may notice the visibility changement, try this :