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 know it is very late but I hope some one would find useful.
I have very simple solution, I have used in my app and works awesome.
Let me explain the logic,
1. Keep track of 2 button clicks - previous button clicked and current button clicked. I am using ArrayList
2. for every button click keep updating the previous and current button clicks value in ArrayList.
3. change the background color of previous button clicked.
4. change the background color of current button clicked.
I hope the logic is simple and straightforward.
Here is the implementation
xml
the OnClick method is defined for every button in XML, in the example it is
onClickRosterDay