1. Engineering
  2. Computer Science
  3. can you do this java and android question using the...

Question: can you do this java and android question using the...

Question details
Can you do this java and android question using the same instructions of the textbook

7. Create a new project named portrait and lande the button onsists of a, mpy Whenever the button is tapped (or pushed as per its caption) its background colour (which starts off being andomColeure gray) should change to some randomly chosen colour The colour is selected from all the possible mixes of the 256 shades of red, green, and blue. ike for its activity and layout. The UI consists of a button that spans the whole screen as in Fig, D1.2 Make sure the button covers the screen in both portrait and landscape orientations The activity method that handles the on-click of the button must follow this logic (in pscudocode): - Generate a random red value in [0,255]. PUSH ME - Generate a random green value in [e,255]. Generate a random blue value in [0,255) Combine these three values into one colour. Grab the button object from the view. - Set the background colour of that object. Here are some APls from the standard Java library that helps you achieve the above. will be n The Moth class has a static method named randon and it returns a random n 10, 1) Ifwe mulniply it by 256 and looked at the procduct as an integer, се,255). Herce, we can generate the red component using a statement like this: int red (int) (256 Math,randomO) The Color class has a static method named rgb. It takes three int the three components and returns a combined colour as one combine the components using a statement like this: integers representing nteget. Hence, we can int c-Color.rgbCred, green, blue); Use the above APls to build the app. Deploy the app and verify that you get a new ground colour with every tap. back i didet nerd a mel in this app becanse there is mo data to be stored and the needed beha ady aiabhe in the lrary (the a tinity can ase the linary directhy withoust going through s mi
Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution