Basically you should follow the scheme:
1) get a link to the object you want to change
findViewById(R.id.<your_object_id>);
2) apply it to the type of object
Button btnYourButton = (Button) findViewById(R.id.<your_object_id>);
3) Use setters on the "btnYourButton" object
4) Redraw your view (possibly calling invalidate ());
It depends on when you want the change to happen. I assume that you will have an eventListener attached to your object, and after the event is fired, you will make your change.
source share