Suppose your created button looks like this:
Button button = (Button) findViewById(R.id.stopButton);
If you want to hide this button, write this ...
button.setVisibility(View.GONE);
And if you want to display this button again, write ...
button.setVisibility(View.VISIBLE);
source
share