Question: QUESTION 3 (a) Explain the purpose of a contextual action bar. (b) Most android applications contain two mechanisms to return from an activity. Identify both

QUESTION 3

(a) Explain the purpose of a contextual action bar.

(b) Most android applications contain two mechanisms to return from an activity. Identify both of these mechanisms and compare their behaviour.

(c) An activity contains a textview and three buttons arranged in a vertical layout. Implement listeners on the buttons that will increment the value of a counter each time one of the buttons is clicked. The first button should increment the counter and simply display its value in the text view.. The second should increment the counter and then display the counter value multiplied by two. Finally, the third 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.button_one, R.id.button_two, R.id.button_three (IDs for all three buttons)

R.id.text_view (ID for the text view)

button_one, button_two, button_three (Button objects for all three buttons)

text_view: (TextView object for the textview)

counter: (The counter to be updated. Assume it is initialised to 0)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!