LaVOZs

The World’s Largest Online Community for Developers

'; android - Cycle background colors for a view - LavOzs.Com

I'm learning how to make Android apps and I'm using a book. In this book there is an exercise which asks to create a view and a button. When you click on a button the view changes. Now I got as far as to make the view(square shape) change color when I click the button but the exercise wants the colors to change like a traffic light. So every time you click the button it should change background colors green, yellow, and red. Mine just changes once and that's it. I click and the color doesn't change anymore. Am I missing a while loop maybe?

Related
ActionBar text color
How to change shape color dynamically?
let user change activity color
Implementing traffic signal in Android
I can't change the color of the background with a click button
Change Circular Button Background and Text alternatively with button clicks
Button onClick, Cycle through Colors/Backgrounds
The cycle does not run automatically
Fill shape with text with two different color