I have 8 buttons in my activity. What I am looking for is, The buttons have a default background and when a button is clicked, the background color should change to some other c
I suggest you this selector.
Just create a simple selector.xml file in drawable folder and then add the selector to your button as android:background="@drawable/selector" or by code like this: yourButton.setBackground(getResources().getDrawable(R.drawable.selector));
selector.xml:
The first item is for pressed, the second for focused and the last is for selected state.