MA Lab Manual
MA Lab Manual
LAB MANUAL
PREPARED BY
Mr.T.Manivel, M.Tech.,(Ph.D)., Assistant Professor, Department of IT
1
MEC / IT / MOBILE APPLICATION LABORATORY
Institution Vision and Mission
Vision
Mission
To prepare the students with high professional skills and ethical values
To impart knowledge through best practices
To instil a spirit of innovation through Training, Research and Development
To undertake continuous assessment and remedial measures
To achieve academic excellence through intellectual, emotional and social stimulation
Vision
Mission
M1: Equip the students with high quality education and carrying out research in emerging
technologies in Information Technology
M2: Expose the students, faculty and staff to a globally competitive learning experience
M3: Motivate the students to realize the responsibility of being professionally proficient
information technocrats to serve the society by inculcating Ethical and Environmental aspects.
2
MEC / IT / MOBILE APPLICATION LABORATORY
Program Educational Objectives (PEOs):
PEO1: Graduates will have successful career in IT and related industries or pursue higher
education and research or evolve as entrepreneurs.
PEO2: Graduates will have the ability and attitude to adapt emerging technological changes
in Information Technology.
PEO3: Graduates will excel as socially committed engineers with high ethical values,
leadership qualities and empathy for the needs of society.
PO2 Problem Analysis: Identify, formulate, review research literature, and analyze
complex engineering problems reaching substantiated conclusions using first principles of
mathematics, natural sciences, and engineering sciences.
PO3 Design / Development Solutions: Design solutions for complex engineering problems
and design system components or processes that meet the specified needs with appropriate
consideration for the public health and safety, and the cultural, societal, and environmental
considerations.
PO5 Modern Tool Usage: Create, select, and apply appropriate techniques, resources, and
modern engineering and IT tools including prediction and modeling to complex
engineering activities with an understanding of the limitations.
PO6 The Engineer and Society: Apply reasoning informed by the contextual knowledge
to assess societal, health, safety, legal and cultural issues and the consequent
3
MEC / IT / MOBILE APPLICATION LABORATORY
responsibilities relevant to the professional engineering practice.
PO8 Ethics: Apply ethical principles and commit to professional ethics and responsibilities
and norms of the engineering practice.
PO9 Individual and Team work: Function effectively as an individual, and as a member
or leader in diverse teams, and in multidisciplinary settings.
PO11 Project Management and Finance Demonstrate knowledge and understanding of the
engineering and management principles and apply these to one’s own work, as a member and
leader in a team, to manage projects and in multidisciplinary environments.
PO12 Lifelong Learning: Recognize the need for, and have the preparation and ability to
engage in independent and life-long learning in the broadest context of technological change.
PSO2: Apply appreciable knowledge of IoT, Cloud Computing and Cyber Security to develop
reliable IT solutions.
PSO3: Exhibit proficiency in Artificial Intelligence and Big Data Analytics for providing
solutions to real world problems in Industry and Research establishments
4
MEC / IT / MOBILE APPLICATION LABORATORY
Do’s and Dont’s in the Laboratory:
DO’s
Know the location of the fire extinguisher and the first aid box and how to use them incase
of an emergency.
Read and understand how to carry out an activity thoroughly before coming to the
laboratory.
DON’Ts
Do not insert metal objects such as clips, pins and needles into the computer casings.
Do not touch, connect or disconnect any plug or cable without your lecturer/laboratory
technician’s permission.
5
MEC / IT / MOBILE APPLICATION LABORATORY
LIST OF PROGRAMS
6
MEC / IT / MOBILE APPLICATION LABORATORY
Index
Aim:
The aim of this lab is to guide you through the process of adding a sample application to a project in Android
Studio. By the end of this exercise, you should be familiar with integrating external code into your Android
Studio project.
Procedure:
1. Open Android Studio:
- Launch Android Studio on your computer.
2. Create a New Project:
- Start a new Android Studio project or open an existing project where you want to add the sample application.
3. Download the Sample Application:
- Visit the official repository or website from which you want to download the sample application.
- Download the source code as a zip file and extract it to a known location on your computer.
4. Open Your Project in Android Studio:
- Navigate to Android Studio and open the project where you want to incorporate the sample application.
5. Import the Sample Application:
- In Android Studio, go to `File > New > Import Module`.
- Choose the directory where you extracted the sample application.
- Follow the on-screen instructions to import the module.
6. Configure Dependencies:
- Open the `build.gradle` file of your main project.
- Add the following line in the `dependencies` block to include the sample application module:
Gradle
implementation project(':sample_module_name')
7. Program Integration:
- Navigate to the code where you want to use functionalities from the sample application.
- Import necessary classes or modules from the sample application in your code.
8. Build and Run:
- Click on the "Run" button in Android Studio.
- Ensure your project builds successfully without any errors.
Output:
Aim:
The aim of this lab is to guide you through the process of creating an Android Virtual Device (AVD) for a sample
project. This is a crucial step in Android app development as it allows you to test your applications on different
virtual devices before deploying them to real devices.
Procedure:
Result:
After completing this lab, you will have a functional Android Virtual Device that can be used for testing and
debugging your Android applications.
Aim:
The aim of this lab is to guide you through the process of creating a launch configuration for a sample
project in Android Studio. Launch configurations are essential for running and debugging applications
efficiently.
Procedure:
Upon completing the lab, you should be able to run and debug your Android application efficiently
using the configured launch configuration. This skill is crucial for effective development and testing in
Android Studio.
Aim:
The aim of this lab is to guide you through the process of running a sample Android application in the
Android Emulator. This exercise will help you familiarize yourself with the Android development
environment and understand the basics of deploying applications on an emulator.
Procedure:
Output:
Upon successful completion of the above steps, you should be able to run a sample Android application
in the Android Emulator without encountering any major issues. The emulator will display the output of
the application, and you'll gain a practical understanding of the deployment process.
Aim:
The aim of this lab is to develop an Android application that implements a submenu. This will enhance
your understanding of creating interactive and user-friendly interfaces using Android Studio.
Procedure:
> java
// Example code snippet for initializing variables and handling click events
Button mainButton = findViewById(R.id.mainButton);
LinearLayout submenuLayout = findViewById(R.id.submenuLayout);
mainButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Toggle visibility of the submenu
if (submenuLayout.getVisibility() == View.VISIBLE) {
submenuLayout.setVisibility(View.GONE);
} else {
submenuLayout.setVisibility(View.VISIBLE);
}
}
});
Program:
> java
// Import necessary packages
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Set click listener for the main button to toggle submenu visibility
mainButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (submenuLayout.getVisibility() == View.VISIBLE) {
submenuLayout.setVisibility(View.GONE);
} else {
submenuLayout.setVisibility(View.VISIBLE);
}
}
});
// Add functionality for submenu items (you can customize this part)
Button submenuItem1 = findViewById(R.id.submenuItem1);
submenuItem1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Implement functionality for submenu item 1
}
});
Result:
Upon successful completion of this lab, you will have gained hands-on experience in creating an Android
application that incorporates a submenu, improving your skills in Android app development.
Aim:
To develop a program that implements a Context Menu, which is a floating list of menu items, in an
Android application.
Procedure:
1. Setup:
- Open Android Studio and create a new Android project.
- Choose an appropriate project template and set the project name.
2. Design Layout:
- Open the XML layout file (`activity_main.xml`) and design the layout where the Context Menu will
be implemented.
3. Implement Context Menu in Java Code:
- Open the Java file corresponding to the main activity (`MainActivity.java`).
- Declare variables and find the View that will trigger the Context Menu.
- Override the `onCreateContextMenu` method to define the menu items.
- Override the `onContextItemSelected` method to handle item selection.
> java
// Sample code snippet
public class MainActivity extends AppCompatActivity {
// Declare variables
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo
menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
// Define menu items
MEC / IT / MOBILE APPLICATION LABORATORY 24
menu.setHeaderTitle("Context Menu");
menu.add(Menu.NONE, 1, Menu.NONE, "Item 1");
menu.add(Menu.NONE, 2, Menu.NONE, "Item 2");
// Add more items as needed
}
@Override
public boolean onContextItemSelected(MenuItem item) {
// Handle item selection
switch (item.getItemId()) {
case 1:
// Implement action for Item 1
return true;
case 2:
// Implement action for Item 2
return true;
// Handle more items as needed
default:
return super.onContextItemSelected(item);
}
}
}
4. Run the Application:
- Connect a device or use an emulator to run the application.
- Observe the Context Menu behavior when triggering the specified View.
Output:
Result:
Upon running the application, the user should be able to trigger a Context Menu by performing a long press
on the designated View. The menu should display the defined items, and selecting an item should execute
the corresponding action.
MEC / IT / MOBILE APPLICATION LABORATORY 25
EXPERIMENT NO: 4
Aim:
The aim of this lab is to develop a simple Android program implementing an email service using Relative
Layout views with different attributes.
Procedure:
1. Setup:
- Open Android Studio and create a new Android Studio project.
- Choose an appropriate project name and set up the basic project parameters.
2. Design the User Interface:
- Open the `activity_main.xml` file.
- Use Relative Layout as the root layout.
- Add necessary views such as EditText for email input, TextView for labels, Button for sending
emails, etc.
- Apply different attributes to the Relative Layout views, adjusting positioning and styling.
3. Implement the Email Service Logic:
- Open the `MainActivity.java` file.
- Implement the necessary logic for sending emails. You can use Android's Intent system to launch the
email client.
- Handle user input validation to ensure a valid email address is entered.
4. Code Example:
> java
// Inside MainActivity.java
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
sendButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String emailAddress = emailEditText.getText().toString();
Output:
Result:
Upon successful implementation, you should be able to demonstrate a working email service program with
a well-designed user interface using Relative Layout views with different attributes.
The aim of this lab is to create a Google Maps (GMaps) application using Android Studio, implementing
the user interface with Linear Layout views and exploring various attributes to enhance the layout.
Procedure:
1. Setup:
- Launch Android Studio and create a new Android Studio project with an empty activity.
- Set the project name as "GMapsApp" and choose an appropriate package name.
- Ensure you have the necessary dependencies for Google Maps in your `build.gradle` file.
2. Designing Layout with Linear Layout:
- Open the `activity_main.xml` file in the `res/layout` directory.
- Replace the default layout with a Linear Layout.
- Experiment with different attributes of the Linear Layout such as `orientation`, `gravity`, and
`layout_weight` to achieve the desired design.
3. Integrate Google Maps:
- In the `activity_main.xml`, add a `fragment` element to hold the Google Maps.
- Obtain a Google Maps API key from the Google Cloud Console and include it in the
`AndroidManifest.xml`.
- Configure the Google Maps fragment to use the obtained API key.
4. Customize Map View:
- Use the Google Maps API to customize the map view.
- Implement features such as zoom controls, map type, and markers on the map.
5. Testing:
- Run the application on an emulator or a physical device to test the functionality.
- Ensure that the Google Maps loads correctly and responds to user interactions.
Program:
> xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center">
</LinearLayout>
Output:
Result:
Upon successful completion of this lab, you will have developed a GMaps application using Linear
Layout views with various attributes. The application will provide a customized map interface and serve
as a foundation for further enhancements and features.
The aim of this lab is to develop a program in Android Studio to implement a custom button and handle
the displayed message on button press.
Procedure:
- Ensure that this method is declared in the XML layout file as the `onClick` attribute for the custom
button.
4. Custom Button Implementation:
- Create a custom button class by extending the `Button` class or using existing components to
create a custom look.
- Implement any additional functionalities or animations for the custom button.
5. Linking Custom Button with Handler:
- In the `onCreate` method of `MainActivity`, find the custom button by its ID and set its
`OnClickListener` to the method created in step 3.
6. Displaying Message:
- Inside the `onCustomButtonClick` method, add code to display a message. For example:
> java
Toast.makeText(getApplicationContext(), "Custom Button Pressed!",
Toast.LENGTH_SHORT).show();
7. Testing:
- Run the application on an emulator or a physical device.
- Press the custom button and verify that the message is displayed as expected.
30
MEC / IT / MOBILE APPLICATION LABORATORY
Output:
Result:
The result of this lab is a functional Android application that demonstrates the implementation of a
custom button and the handling of the displayed message upon button press.
31
MEC / IT / MOBILE APPLICATION LABORATORY
EXPERIMENT NO: 7
Aim:
The aim of this lab is to develop an Android program that implements a table layout in a view group.
The program should display child view elements in rows and columns, creating an organized and
visually appealing interface.
Procedure:
Program :
> java
// MainActivity.java
import android.os.Bundle;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
@Override
32
MEC / IT / MOBILE APPLICATION LABORATORY
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Output:
Result:
The successful execution of the program will demonstrate the effective implementation of a table layout
in an Android view group, providing a clear structure for organizing and displaying child view elements.
33
MEC / IT / MOBILE APPLICATION LABORATORY
EXPERIMENT NO: 8
Aim:
The aim of this lab is to develop a program that implements a List View in an Android application. List
View is a fundamental UI component that displays a scrollable list of items, providing an efficient way
to present a set of data to the user.
Procedure:
4. Create an Adapter:
- Implement a custom adapter class to bind the data source to the List View.
- Override methods like `getView()` to customize the appearance of each list item.
34
MEC / IT / MOBILE APPLICATION LABORATORY
Program:
> java
// MainActivity.java
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import androidx.appcompat.app.AppCompatActivity;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
35
MEC / IT / MOBILE APPLICATION LABORATORY
Output:
Result:
The developed Android application successfully implements a List View, providing a user-friendly
display of the specified data.
36
MEC / IT / MOBILE APPLICATION LABORATORY
EXPERIMENT NO: 9
The aim of this lab is to develop a program demonstrating the implementation of a date picker control
in an Android application using the Android Development Kit (ADK). Participants will learn how to
integrate and utilize the date picker control to enhance user interaction with date selection in their
Android apps.
Procedure:
Program:
> java
// MainActivity.java
import android.app.Activity;
import android.os.Bundle;
import android.widget.DatePicker;
import android.widget.Toast;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
datePicker = findViewById(R.id.datePicker);
datePicker.init(
datePicker.getYear(),
datePicker.getMonth(),
datePicker.getDayOfMonth(),
this
);
}
@Override
public void onDateChanged(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
String selectedDate = dayOfMonth + "/" + (monthOfYear + 1) + "/" + year;
Toast.makeText(getApplicationContext(), "Selected Date: " + selectedDate,
Toast.LENGTH_SHORT).show();
}
}
Output:
Result:
Upon completion of this lab, participants will have gained hands-on experience in integrating and
utilizing the date picker control in an Android application using ADK. They will be able to enhance the
user experience by allowing users to easily select dates within their apps.
38
MEC / IT / MOBILE APPLICATION LABORATORY
EXPERIMENT NO: 10
Aim:
The aim of this lab is to develop an Android application using SQLite to manage employee details. The
program should allow users to insert, delete, display, and update employee information.
Procedure:
39
MEC / IT / MOBILE APPLICATION LABORATORY
Output:
Result:
The program should effectively insert, delete, display, and update employee details, providing a
seamless user experience.
40
MEC / IT / MOBILE APPLICATION LABORATORY
EXPERIMENT NO: 11
Aim:
The aim of this lab is to design and implement signup and signin pages for an Alarm Application using
Android Studio. This involves creating user interfaces for user registration and authentication.
Procedure:
1. Project Setup:
- Open Android Studio and create a new Android Project.
- Choose an appropriate project name and select the Empty Activity template.
- Set the language to Java.
2. Layout Design:
- Design the signup and signin screens using XML in the `res/layout` folder.
- Use `EditText` for input fields, `Button` for action triggers, and any other necessary components.
- Consider adding appropriate constraints and styles.
3. Activity Implementation:
- Create Java classes for SignupActivity and SigninActivity.
- Link the XML layouts to the corresponding activities using `setContentView()` in the `onCreate`
method.
- Implement basic functionality for each activity, such as handling button clicks.
4. User Authentication:
- Utilize Firebase Authentication or any preferred authentication library.
- Set up the necessary configurations for the chosen authentication method.
- Implement user registration and login functionality in the respective activities.
5. Connect Activities:
- Implement navigation between the signup and signin activities.
- Use `Intent` to move between activities when signup is successful or when the user wants to
switch between signup and signin.
6. Testing:
- Run the application on an emulator or a physical device.
- Test the signup and signin functionalities to ensure a smooth user experience.
- Verify that user data is being captured and stored securely.
Program:
Below is a simplified example of the Java code for the Signup Activity:
41
MEC / IT / MOBILE APPLICATION LABORATORY
>java
public class SignupActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_signup);
etUsername = findViewById(R.id.editTextUsername);
etEmail = findViewById(R.id.editTextEmail);
etPassword = findViewById(R.id.editTextPassword);
btnSignup = findViewById(R.id.buttonSignup);
btnSignup.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// Implement signup logic here
}
});
}
}
Output:
42
MEC / IT / MOBILE APPLICATION LABORATORY
Result:
Upon successful implementation, the application should provide users with a seamless experience for
signing up and signing in. Users' credentials should be securely stored and authenticated.
43
MEC / IT / MOBILE APPLICATION LABORATORY
b.Developing Signup and Signin Pages in Calculator Application
Aim:
The aim of this lab is to design and implement signup and signin pages for a calculator application using
Android Studio. This will involve creating user interfaces for both signup and signin, implementing
functionality for user authentication, and integrating these pages into the calculator application.
Procedure:
7. Testing:
- Test the signup and signin functionality thoroughly.
44
MEC / IT / MOBILE APPLICATION LABORATORY
- Ensure that user data is securely stored and retrieved during authentication.
- Test the integration with the calculator application to verify a smooth transition between
authentication and calculator functionalities.
Program:
Below is a simplified example of the Java code for the Signup Activity. Repeat a similar process for
the Signin Activity.
>java
// SignupActivity.java
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_signup);
Output:
45
MEC / IT / MOBILE APPLICATION LABORATORY
Result:
Upon completion of this lab, you will have successfully developed and designed signup and signin pages
for a calculator application using Android Studio, enhancing the user experience and providing secure
authentication functionality.
46
MEC / IT / MOBILE APPLICATION LABORATORY
c.Developing Signup and Signin Pages in Weather Application
Aim:
The aim of this lab is to design and implement signup and signin pages for a Weather Application using
Android Studio. This will involve creating user interfaces for user registration and authentication, as
well as programming the necessary functionalities.
Procedure:
1. Setup:
- Open Android Studio and create a new Android project.
- Choose an appropriate project name and package.
- Select a blank activity template.
47
MEC / IT / MOBILE APPLICATION LABORATORY
Program (Firebase Authentication):
>java
// In SignUpActivity.java
FirebaseAuth auth = FirebaseAuth.getInstance();
auth.createUserWithEmailAndPassword(email, password)
.addOnCompleteListener(this, task -> {
if (task.isSuccessful()) {
// Signup success
// Navigate to the main application or home page
} else {
// Signup failed, display an error message
Toast.makeText(SignUpActivity.this, "Signup failed.", Toast.LENGTH_SHORT).show();
}
});
// In SignInActivity.java
FirebaseAuth auth = FirebaseAuth.getInstance();
auth.signInWithEmailAndPassword(email, password)
.addOnCompleteListener(this, task -> {
if (task.isSuccessful()) {
// Signin success
// Navigate to the main application or home page
} else {
// Signin failed, display an error message
Toast.makeText(SignInActivity.this, "Authentication failed.",
Toast.LENGTH_SHORT).show();
}
});
Output:
48
MEC / IT / MOBILE APPLICATION LABORATORY
Result:
Upon successful implementation, the Weather Application should allow users to seamlessly signup
and signin. A successful signup or signin should transition the user to the main application screen.
Error messages should be displayed for unsuccessful attempts.
49
MEC / IT / MOBILE APPLICATION LABORATORY
d.Developing Signup and Signin Pages in Video Player Application
Aim:
The aim of this lab is to design and implement Signup and Signin pages for a Video Player Application
using Android Studio. This involves creating user interfaces for user registration and authentication
processes.
Procedure:
Program:
>java
50
MEC / IT / MOBILE APPLICATION LABORATORY
// Import necessary packages
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_signup);
>java
// Import necessary packages
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_signin);
Output :
51
MEC / IT / MOBILE APPLICATION LABORATORY
Result:
Users will be able to seamlessly navigate through the Signup and Signin pages, providing a secure and
user-friendly experience for accessing the Video Player Application. Successful registration and
authentication will grant access to the video content, while appropriate error handling will ensure a
smooth user experience.
52
MEC / IT / MOBILE APPLICATION LABORATORY