Mobile Application Development
Mobile Application Development
Mobile Application Development
0000
Three Hours
No. of Questions: 01
● The mode of the exam will be in the form of an online, open book examination
● If a page or a part of this question paper is not printed, please inform the supervisor ,
invigilator or the examination unit via the hotlines provided
● Candidate's registration number, Module code and Module Name should be written clearly
and legibly on all answer sheets
● Candidates must not seek, give or receive assistance of any kind during the exam. Any
cheating, any attempt to cheat, assisting others to cheat, or participating therein, or engaging
in such improper conduct is a serious violation and will generally result in disqualification of
the candidate’s paper, and any other disciplinary action as may be deemed appropriate.
● Candidates are requested to adhere to the examination guidelines circulated
PL/EX/02 REV:00/00.00.0000
Q1. This question has nine steps, follow all the steps.
1. Load android studio and create a new Android application with the following.
Application Name: HealthApp
Package Name: lk.sltc.healthapp
Project Location: Desktop/{YourRegNumber}/
Phone and Tablet - min SDK – API 30
2. Open build.gradle(Module: HealthApp.app) file (ref: figure 1) and add the following line to
the dependencies block (ref: figure 2), and then click on “sync now” and wait till it
completes.
implementation 'com.google.code.gson:gson:2.9.0'
3. Create a model class for Goal and create the constructor and getters for all attributes
mentioned below. (Total: 20 marks)
code - string variable
name - string variable
description - string variable
Create a model class for Person and create the constructor for firstName, lastName and
email, and create getters and setters for all the attributes mentioned below.
Drag and drop the Preferences.java file (which is given to you as prerequisites) to your main
package. Open up the Preferences.java file and go through each and every method and
study what each method does.
Figure 3: activity_main.xml
a. Add a new layout file and name it list_goal_item.xml and design the xml so that it
can hold on to one of the items in the list given below. Use two TextViews.
PL/EX/02 REV:00/00.00.0000
Figure 4: activity_goals.xml
6. Right click on your package and create a new Java class and name it GoalListViewHolder (The
super class should be RecyclerView.ViewHolder) . (Total: 5 marks)
a. Define attributes to hold each of the views in list_goal_item.xml.
b. Create the constructor, and initialize each of the attributes using findViewById.
PL/EX/02 REV:00/00.00.0000
7. Right click on your package and create a new Java class and name it GoalListViewAdapter
(The super class should be RecyclerView.Adapter). Please do the following. - (Total: 10
marks)
a. Define attributes of type List<Goal>, Activity object and SharedPreferences, and
create a constructor to pass values for these three attributes.
b. Implement getItemCount method and return the size of the gosl list.
c. Implement onCreateViewHolder method and use the Layout Inflater to inflate the
item view and create a ShoppingListItemViewHolder object and return it.
i. Set the name text and description text of the view holder by using the
appropriate goal object (use the position passed to the onBindViewHolder method to get
the goal object)
ii. Define an onClickListener to the itemView and inside the onClick method
update the goal of the current person by calling the appropriate methods in the Preferences
class.
iii. Create another empty activity and give it the name “PersonalInfoActivity”
and navigate to that activity by calling startActivity method.
Figure 5: activity_personal_info.xml
ii. Create another empty activity and give it the name “SummaryActivity”
and navigate to that activity by calling startActivity method.
PL/EX/02 REV:00/00.00.0000
Figure 6: activity_summary.xml