Question
Part 1: Write an app that simulates a traffic light. It should display a label(TextView) and a button. The label represents the current color of
Part 1: Write an app that simulates a traffic light. It should display a label(TextView) and a button. The label represents the current color of a traffic light and can be red, green, or yellow. When the user clicks on the button, the label cycles to the next color and simulates running the traffic light. Look at the documentation of the View class to figure out how to change the color of a View programmatically. You decide on the layout and screen design. Include a traffic light model. (20 points)
Part 2: Write and app that lets the user create a color using the RBG color model. It displays 3 input fields and one label. The user should be prompted to enter numbers between 0 and 255. If an input is less than 0 it should be made 0, if it is greater than 255 it should be set to 255. Each of the input boxes represents a color value Red, Green, and Blue. When the number in any of the text fields changes, update the background color of the label. (40 points)
Part 3: Now rewrite the app from Part 1, only do not use xml. (40 points)
Using Android Studio.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started