Question
QUESTION 1 (a) Explain why densely packed UI controls do not work well on mobile devices. (b) The battery resource must be carefully managed on
QUESTION 1
(a) Explain why densely packed UI controls do not work well on mobile devices.
(b) The battery resource must be carefully managed on a mobile device. Outline two example scenarios where management of the battery resource is a concern for the developer and explain how this is achieved in each case.
(c) It is often difficult to determine which features and UI components to include in an activity. The FIT scheme can be helpful in this regard. Explain what the FIT scheme is and how it can be applied.
QUESTION 2
(a) What is a virtual sensor? Explain why it is sometimes necessary to take readings from a virtual sensor.
(b) Explain, with the help of two examples, why readings from more than one sensor of the same type might be combined.
(c) Explain why an application is much more useful if it can determine the users situation and context. Provide an example of how combining data from different sensors can be used for this purpose.
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:
Page 4 of 4 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)
QUESTION 4
(a) Write an onDraw() method of a custom view that will draw 16 filled rectangles arranged in a 4x4 pattern. Each row should have a different colour. Note that you are required to use the matrix stack to move to each rectangle draw it and return to the origin. You are provided with the following variables. canvas: a Canvas object that can be queried for dimensions and draw basic primitives bounding_box: A Rect object that will be used for drawing rectangles colours[4]: array of Paint objects set to be red, blue, green, and yellow respectively
(b) Explain the purpose of an intent. Compare an implicit intent and an explicit intent with regard to how they are launched and when each is best used.
QUESTION 5
(a) In relation to permissions, explain the purpose of the manifest file and describe how it used at install time. Explain what happens when an application tries to use a permission that it has,as well as when an application tries to use a permission that it does not have.
(b) You are presented with an application that produces exceptions stating that the ACCESS_FINE_LOCATION and ACCESS_COARSE_LOCATION permissions were not granted. Summarise the possible causes of this and state the changes you would make to the application to ensure these exceptions did not appear.
(c) Whitelisting is arguably more secure than blacklisting and therefore, a generally better approach to security. Discuss.
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