ANDROID PROGRAMMING EXAMINATION

UE CP 313 2020-2021


SECTION A: (15 MARKS)

QUESTION 1

Answer the following questions:


a. With example, explain the difference between Implicit and Explicit Intent. (2 Marks)


b. Define a Splash Screen. (1 Mark)


c. Name the two permissions you need to declare in your AndroidManifest.xml file for sending and receiving SMS messages. (1 Mark)


d. What is the difference between the onPause() method and the onSaveInstanceState() method? (1 Mark)


QUESTION 2

Provide a brief description of the following android project resources: (1 Mark Each)

a. res/mipmap


b. Gradle


c. res/drawable


d. Menu


e. Manifests/


QUESTION 3

With examples, briefly provide the explanation of the following features: (1 Mark Each)

a. String.xml


b. Colors.xml


c. Android Virtual Device (AVD)


d. TOAST


e. View


SECTION B: (45 MARKS)

Attempt THREE (3) out of FOUR (4) questions in this section.


QUESTION 4

You have been asked by the management of Dodoma Secondary School to develop a mobile application that will store the information of the students. The app should store name, region, age, gender and subjects of the student. The management want to show the reports of how the student performs his/her subjects (English, Mathematics, Physics, Chemistry and Biology). The management also wants to show the dates of different events within the school. The management suggests the following features to be used: radio button for gender, spinner for region, and checkboxes for subjects. Use progress bar to show the performance of the students and calendar to show the dates of the events. Based on the given requirements, you found that the application has only two activities i.e. ActivityOne and ActivityTwo.


a. Using the methods of Intent class show how you will send the student’s data to the second activity. (3 Marks)


b. Using the methods of Intent class show how you will receive the student’s data within the second activity. (3 Marks)


c. By the help of SQLiteOpenHelper class, show how you can save the student’s details in a database. Use user and student as the name of the database and table respectively. (9 Marks)


QUESTION 5

The prime purpose of a content provider is to serve as a central repository of data where users can store and can fetch the data. The access of this repository is given to other applications also but in a safe manner in order to serve the different requirements of the user. Write an application that will allow users store their details such as name and phone numbers in a content provider. The application should also allow other applications to retrieve the stored user’s information. The application has one activity called MainActivity, two edit texts for name and phone number and two buttons for save data and view data. The ids for the views are etName, etPhoneNumber, btnSave and btnView. (15 Marks)


QUESTION 6

Android Fragment represents a behavior or a portion of a user interface in an activity. Multiple fragments can be combined in a single activity to build a multi-panel User Interface (UI) and reuse a fragment in multiple activities. As a mobile apps developer, you have been asked to develop an application with two fragments named FragmentOne and FragmentTwo. When a user click on the specific fragment, the description of the fragment displays on the fragment container in the main activity which hosts the fragments. Assume the ids for FragmentOne and FragmentTwo are btnFragment_one and btnFragment_two respectively. Hint: use linear layout to create a fragment container. (15 Marks)


QUESTION 7

(a) There are tasks that do not really need to be visible to the user. A good example is playing a music. You don’t need to keep the player’s screen for song to play. Those kinds of applications/tasks runs in the background.

i. Suggests the kind of android component that you can use to accomplish such kind of task. (2 Marks)


ii. Based on your suggestion in part (i), write a java class to implement a task for playing music. Assume the music you want to play is located at Settings.System.DEFAULT_RINGTONE_URI (7 Marks)


(b) The management of CIVE cafeteria wants to implement an android system that will manage its customers. The application has only one activity named MainActivity with three edit texts and one button. One of the functionality of the application is to store the customer’s information such as name, email and phone number. The customer’s data are in small amount and are in key/value pairs. Write an android application that will store the customer’s information in a Shared Preference. The ids for the edit texts and button are etName, etEmail, etPhoneNumber and btnSave. (6 Marks)


END OF EXAMINATION PAPER