Lab Manual
Mobile Application Development
Department of Computer Science
Superior University, Lahore
Lab Plan
Lab # 01: Introduction and Installation 3
Lab # 02: Understanding the layouts 13
Lab # 03: Understanding Activities, Linking Activities using Intents 14
Lab # 04: Fragmentation And Display Of Notification 16
Lab # 05: Understanding the components of a screen 18
Lab # 06: Adapt And Manage Changes In Screen Orientation 19
Lab # 07: Designing Your User Interface with Views 21
Lab # 08: Designing UI with Views To Display Images On The Screen 22
Lab # 09: Understanding Specialized Fragmentation 24
Lab # 10: Displaying Pictures and Menus with Views 25
Lab # 11: Database 27
Lab # 12: Content Providers 28
Lab # 13: Messaging 30
Lab # 14: Location Based Services 32
Lab Manual Mobile Application Development
Lab-01.: Introduction and Installation
Objective:
The objective of this lab session is to install the components for
Android Development.
By the end of this lab students will be able:
● To Install Android studio
● To Install Software Development kit
● To Install Java Development Kit
● Create Android Virtual Devices (AVDs) and Launch Your First Application
TASK 1: Install Latest version of Java Development kit (JDK) Steps to be
followed for installation:
STEP1:
Department of Computer Science Page 1
Lab Manual Mobile Application Development
STEP2:
STEP3:
Department of Computer Science Page 2
Lab Manual Mobile Application Development
STEP4:
STEP5:
Department of Computer Science Page 3
Lab Manual Mobile Application Development
STEP6:
STEP7:
Department of Computer Science
Lab Manual Mobile Application Development
TASK 2: Path Setting And Verification Of JDK
STEP1:
STEP2:
Department of Computer Science
Lab Manual Mobile Application Development
STEP3:
STEP4:
Department of Computer Science
Lab Manual Mobile Application Development
STEP5:
STEP6:
Department of Computer Science
Lab Manual Mobile Application Development
STEP7:
STEP8:
Department of Computer Science
Lab Manual Mobile Application Development
TASK 3: Install Software Development Kit (SDK)
TASK 4: Install Android Studio
Department of Computer Science
Lab Manual Mobile Application Development
Lab-02.: Understanding the Layouts
Objective:
The objective of this lab session is develop an application that uses layout
Managers and event listeners
By the end of this lab students will be able:
● To learn how to design in xml file.
● To insert and use button & text box.
● To implement Relative layout & LinearLayout.
● To implement java code in main activity to change the color & font size.
TASK 1: Create the .xml file and insert two buttons and one text
box to change font size and color.
TASK 2: To create mainactivity.java file and write a code to
change the color and font size by clicking on the button
Department of Computer Science
Lab Manual Mobile Application Development
TASK 3: Build calculator using relative and linear layouts as shown below.
TASK 4: Create a form using layout and show results on Emulator.
Department of Computer Science
Lab Manual Mobile Application Development
Lab-03.: Understanding and Linking Activities Using Intents
Objective:
This lab session describes how activities work and the ways by which you
can link them. This session also demonstrate a very useful concept in
android -- the Intent that enables different activities to be connected.
By the end of this lab students will be able:
● To understand how to apply styles and themes to activities.
● How to display activities as a dialog.
● Understanding the concept of Intent.
TASK 1: Create an activity with a hidden title bar.
Department of Computer Science
Lab Manual Mobile Application Development
TASK 2: Display a dialog window using activity as shown below.
TASK 3: Display a progress dialog on window
TASK 4: How can we link activities using intent? Run and show results on Emulator
Department of Computer Science
Lab Manual Mobile Application Development
Lab-04.: Fragmentation and Display of Notification
Objective:
The objective of this lab session is to understand how fragments work
and the various forms in which you can display them.
By the end of this lab students will be able:
● To understand how to use fragments to customize your UI.
● How to display alerts to the user using notification.
TASK (1+ 2): Create an activity and show the basics of working with fragments.
How you can add fragments programmatically to an activity during runtime.
Department of Computer Science
Lab Manual Mobile Application Development
TASK (3+4): Use the NotificationManager to display a message at the top of device
and show your results on the emulator as shown below.
Department of Computer Science
Lab Manual Mobile Application Development
Lab-05.: Understanding the Components of a Screen
Objective:
The objective of this lab session is to understand how View Groups can be
used to lay out views and organize the application screen.
By the end of this lab students will be able:
● To use ViewGroups
● To familiar with Layouts
TASK (1+ 2): How View Groups can be used to lay out your views
and organize your application screen.
TASK (3+4): How Layouts can be used to lay out your views
and organize your application screen.
Department of Computer Science
Lab Manual Mobile Application Development
Lab-06.: Adopt and Manage Changes In Screen Orientation
Objective:
The objective of this lab session is to discover how to handle changes in
screen orientation on your android device.
By the end of this lab students will be able:
● Managing Changes to Screen Orientation
● Utilizing the Action Bar
TASK (1+ 2): Create an application by employing two techniques to
handle changes in screen orientation.
(i) Portrait mode (ii) Landscape mode
Department of Computer Science
Lab Manual Mobile Application Development
TASK (3+4): Show the behavior of an activity when the device changes orientation.
Department of Computer Science
Lab Manual Mobile Application Development
Lab-07.: Designing Your User Interface With Views
Objective:
The objective of this lab session is to understand how to create the UI using
code and how much this approach is useful, If your UI needs to be
dynamically generated during runtime.
By the end of this lab students will be able:
● To create the User Interface Programmatically
● To listen for UI Notifications
TASK (1+ 2): Demonstrate how the code needed to dynamically build
the UI in your activity.
(i) Create a layout params object to specify the layout parameter
that can be used by other views.
(ii) Create a LinearLayout object to contain all the views in your activity.
TASK (3+4): Create a TextView and a ButtonView and then
added them to LinearLayout object
(i) Create a layout params object to be used by the LinearLayout object.
(ii) Add a LinearLayout object to the activity.
Department of Computer Science
Lab Manual Mobile Application Development
Lab-08.: Designing UI with Views To Display Images On The
Screen
Objective:
The objective of this lab session is to develop an application that uses
various Views to display images on the screen and difference between the
option menus and context menus.
By the end of this lab students will be able to understand:
● How to use the basic views in Android to design your user interface?
● How to use the picker views to display lists of items?
● How to use the list views to display lists of items?
TASK (1+ 2): By using some of the Basic View as given below; try to
design the UI of your android application.
Department of Computer Science
Lab Manual Mobile Application Development
TASK (3+4): Show how to use:
(i) TimePicker View (ii) DatePicker View
Department of Computer Science
Lab Manual Mobile Application Development
Lab-09.: Understanding Specialized Fragmentation
Objective:
The objective of this lab session is to understand the specialized fragmentation.
By the end of this lab students will be able:
● To create the XML file for the fragment.
● To understand how to add two fragments to the activity
TASK (1+ 2): Create the XML file for the fragment by adding a
ListView element and then declare an array to contain the list of
president names in your activity.
TASK (3+4): Add two fragments to the activity and note the
height of each fragment.
Department of Computer Science
Lab Manual Mobile Application Development
Lab-10.: Displaying Pictures and Menus with Views
Objective:
The objective of this lab session is to develop an application that uses various Views to
display images on the screen and difference between the option menus and context menus.
By the end of this lab students will be able:
To work with views that enable them to display images..
To create option and context menus in your android application.
TASK (1+ 2): By using the ImageView view, try to display images on the screen.
Department of Computer Science
Lab Manual Mobile Application Development
TASK (3+4): Display the option menu for your activity by
implementing two methods in your activity as given below.
(i) OnCreateOptionsMenu( ) (ii) OnOptionsItemSelected( )
Department of Computer Science
Lab Manual Mobile Application Development
Lab-11.: Database
Objective:
The objective of this lab session is develop an application that makes use of
database By the end of this lab students will be able To understand the concepts of
● To insert Textbox, Text View and Buttons.
● To create Add Employee Button which adds Employee.
● To create Delete Employee Button which deletes Employee.
● To create Modify Employee Button which modifies Employee.
● To create View and View All Employee Button which views Employee.
TASK (1+2): To create a design in main.xml file as given below.
TASK (3+4): Create mainactivity.java file to connect database and android studio
and link buttons with text box to show results. Perform the operations to Add,
delete, Update, View and View All records.
Department of Computer Science
Lab Manual Mobile Application Development
Lab-12.: Content Providers
Objective:
The objective of this lab session is to find out how to use the built in content
providers, as well as implement your own content providers to share data
across packages.
By the end of this lab students will be able
To understand the concepts of
● To understand the functionality of Content Providers
● Sharing Data in Android
● Creating your own Content Providers
TASK (1+2): Using content provider, show how to retrieve the contacts stored in
the contacts application and display them in the ListView.
Department of Computer Science
Lab Manual Mobile Application Development
TASK(3+4): Show how can you check that your application has
permission to access the contacts.
Department of Computer Science
Lab Manual Mobile Application Development
Lab-13.: Messaging
Objective:
The objective of this lab session is to develop an application that
demonstrates how to send SMS message from your android application.
You can also find out how to invoke the Mail application from your android
app to send email messages to other users.
By the end of this lab students will be able
To understand the concepts of
● How to send SMS messages programmatically from your application.
● How to send email messages from your application.
TASK (1+2): Create an application which can send SMS
message to a recipient without user intervention.
Department of Computer Science
Lab Manual Mobile Application Development
TASK (3+4): By using an Intent object and set the various
parameter using the setData( ), putExtra( ), and setType( ) methods
launch the built in application to send an email message.
Department of Computer Science
Lab Manual Mobile Application Development
Lab-14.: Location Based Services
Objective:
The objective of this lab session is to develop an application that makes
use of Displaying Google Maps in your Android Application.
By the end of this lab students will be able
To understand the concepts of
● Displaying Google Maps in your Android application.
● Displaying zoom controls on the map.
● Switching between your activity to map and browser.
TASK (1+2): Show google map displayed in the applications
activity and display the built in zoom control.
Department of Computer Science
Lab Manual Mobile Application Development
TASK (3+4): Create an activity and place two buttons in XML file.
(i) Create onClick method for Map.
(ii) Create onClick method for browser
Department of Computer Science