(c) An activity contains a textview and three buttons arranged in a horizontal layout. Implement listeners on the buttons that will advance the value of a counter each time one of the buttons is clicked. The first button should increment the counter and display its value in the text view. The second should multiply the counter by two if the counter value is odd and display its value. If the counter value is even, its value should be displayed unchanged. Finally, the third button should increment the counter and then display the counter value modulus 3. Write an onCreate() method to do all of the above including constructing the relevant controls from their specification in the XML layout file. The following are the controls and variables in the application:
R.id.btnLeft, R.id.btnCenter, R.id.btnRight R.id.txtShowCounter
btnLeft, btnCenter, btnRight txtShowCounter
(IDs for all three buttons)
(ID for the text view)
(Button objects for all three buttons) (TextView object for the textview)
counter:
QUESTION 4
(The counter to be updated. Assume it is initialised to 0)