mobile application development master file

DilpreetKaur169408 5 views 23 slides Oct 28, 2025
Slide 1
Slide 1 of 23
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23

About This Presentation

very good


Slide Content

MAD FILE(PDF) - 3rd semester file
Masters in computer applicaitions (I. K. Gujral Punjab Technical University)
Scan to open on Studocu
Studocu is not sponsored or endorsed by any college or university
MAD FILE(PDF) - 3rd semester file
Masters in computer applicaitions (I. K. Gujral Punjab Technical University)
Scan to open on Studocu
Studocu is not sponsored or endorsed by any college or university
Downloaded by Dilpreet Kaur ([email protected])
lOMoARcPSD|23838930

SR.NO. ASSIGNMENTS PAGE NO. SIGNATURE
1. Using emulator to deploy and run mobile apps . 1-2
2. Create an Android application that shows Hello +
name of the user and run it on an emulator.
3
3. Create an application that takes the name from a
text box and shows hello message along with the
name entered in text box, when the user clicks the
OK button
4-5
4. Develop an ANDRIOD application that uses GUI
components, Font and Colours.
6-8
5. Write an application that draws basic graphical
primitives on the screen.
9-10
6. Develop an application that uses Layout Managers
and event listeners
11-14
7. Create and Login application as above. On
successful login, open browser with any URL.
15-17
8. Testing mobile app - unit testing, black box testing
and test automation.
18-19
9. Create an iOS application that can play audio and
video files.
20-21















Downloaded by Dilpreet Kaur ([email protected])
lOMoARcPSD|23838930

| 1 P a g e

1. Using emulator to deploy and run mobile apps .
 Click on Create Device


 Select hardware

Downloaded by Dilpreet Kaur ([email protected])
lOMoARcPSD|23838930

| 2 P a g e

 Select System image

 After app on running emulator



Downloaded by Dilpreet Kaur ([email protected])
lOMoARcPSD|23838930

| 3 P a g e

2. Create an Android application that shows Hello + name of the user and run it on an
emulator.
Activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello user"
app:layout_constraintBottom_toBottomOf ="parent"
app:layout_constraintEnd_toEndOf ="parent"
app:layout_constraintStart_toStartOf ="parent"
app:layout_constraintTop_toTopOf ="parent" />

</androidx.constraintlayout.widget.ConstraintLayout >

Output..


Downloaded by Dilpreet Kaur ([email protected])
lOMoARcPSD|23838930

| 4 P a g e

3. Create an application that takes the name from a text box and shows hello
message along with the name entered in text box, when the user clicks the OK
button.
Activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp"
tools:context=".MainActivity">

<EditText
android:id="@+id/nameEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter your name" />
<Button
android:id="@+id/okButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="OK" />
<TextView
android:id="@+id/helloTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text=""
android:textSize="18sp" />
</LinearLayout>
MainActivity.java
package com.example.secondone ;

import androidx.appcompat.app.AppCompatActivity ;

import android.os.Bundle;
import android.view.View;
import android.widget.Button ;
import android.widget.EditText ;
import android.widget.TextView ;

public class MainActivity extends AppCompatActivity {
private EditText nameEditText;
private Button okButton;
private TextView helloTextView;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView( R.layout.activity_main);

nameEditText = findViewById(R.id.nameEditText);
okButton = findViewById(R.id.okButton);
helloTextView = findViewById(R.id.helloTextView);
Downloaded by Dilpreet Kaur ([email protected])
lOMoARcPSD|23838930

| 5 P a g e


okButton.setOnClickListener( new View.OnClickListener() {
@Override
public void onClick(View view) {
String name = nameEditText.getText().toString();
String helloMessage = "Hello, " + name + "!";
helloTextView.setText(helloMessage);
}
});
}
}
Output..










Downloaded by Dilpreet Kaur ([email protected])
lOMoARcPSD|23838930

| 6 P a g e

4. Develop an ANDRIOD application that uses GUI components, Font and Colours.
Activit_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start"
android:orientation="vertical"
tools:context=".MainActivity">

<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="150dp"
android:text="hello world!"
android:textStyle="bold"
android:textAlignment="center"
android:textSize="30dp" />

<Button
android:id="@+id/button2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:text="change font"
android:textSize="20dp"/>

<Button
android:id="@+id/button3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:textSize="20dp"
android:text="change color" />
</LinearLayout>

MainActivity.java
package com.example.myapplication ;
import androidx.appcompat.app.AppCompatActivity ;

import android.graphics.Color ;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView ;
import android.widget.Button ;
public class MainActivity extends AppCompatActivity {
float font=30;
int ch=1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView( R.layout.activity_main);
Downloaded by Dilpreet Kaur ([email protected])
lOMoARcPSD|23838930

| 7 P a g e

TextView t1=findViewById(R.id.textView);
Button b1=findViewById(R.id.button2);
Button b2=findViewById(R.id.button3);
b1.setOnClickListener( new View.OnClickListener() {
@Override
public void onClick(View v) {
t1.setTextSize(font);
font+=5;
if(font==40){
font=30;
}
}
});
b2.setOnClickListener( new View.OnClickListener() {
@Override
public void onClick(View v) {
switch (ch) {
case 1:
t1.setTextColor(Color.BLUE);
break;
case 2:
t1.setTextColor(Color.GREEN);
break;
case 3:
t1.setTextColor(Color.BLACK);
break;
case 4:
t1.setTextColor(Color.GREEN);
break;
}
ch++;
if(ch==4){
ch=1;
}}});} }

Output..
Before.

Downloaded by Dilpreet Kaur ([email protected])
lOMoARcPSD|23838930

| 8 P a g e

After.














Downloaded by Dilpreet Kaur ([email protected])
lOMoARcPSD|23838930

| 9 P a g e

5. Write an application that draws basic graphical primitives on the screen.
Activit_main.xml

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

<ImageView
android:id="@+id/imageview"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf ="parent"
app:layout_constraintEnd_toEndOf ="parent"
app:layout_constraintStart_toStartOf ="parent"
app:layout_constraintTop_toTopOf ="parent" />

</androidx.constraintlayout.widget.ConstraintLayout >

MainActivity.java
package com.example.graphic;

import androidx.appcompat.app.AppCompatActivity ;
import android.graphics.Color ;
import android.os.Bundle;
import android.graphics.Bitmap ;
import android.widget.ImageView ;
import android.graphics.Canvas ;
import android.graphics.Paint ;
public class MainActivity extends AppCompatActivity {
Bitmap bg;
ImageView img;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView( R.layout.activity_main);
bg=Bitmap.createBitmap( 720, 1280, Bitmap.Config.RGB_565);
img=findViewById(R.id.imageview);
img.setImageBitmap(bg);
Canvas canvas=new Canvas (bg);
Paint paint=new Paint();
paint.setColor(Color.BLUE);
paint.setTextSize(50);

canvas.drawText("Rectangle",420,150,paint);
canvas.drawRect(400,200,650,700,paint);

canvas.drawText("Circle",120,150,paint);
canvas.drawCircle(200,350,150,paint);;

canvas.drawText("square",120,800,paint);
canvas.drawRect(50,850,6350,1150,paint);
Downloaded by Dilpreet Kaur ([email protected])
lOMoARcPSD|23838930

| 10 P a g e

}
}

Output..















Downloaded by Dilpreet Kaur ([email protected])
lOMoARcPSD|23838930

| 11 P a g e

6. Develop an application that uses Layout Managers and event listeners.
Activit_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="100dp"
tools:ignore="MissingConstraints" >
<TextView android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="30dp"
android:text="Details Form"
android:textSize="25sp"
android:gravity="center"/>
</LinearLayout>
<GridLayout android:id="@+id/gridLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="100dp"
android:layout_marginBottom ="200dp"
android:columnCount="2"
android:rowCount="4">

<TextView android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_row="0"
android:layout_column="0"
android:text="Name"
android:textSize="20sp"
android:gravity="center"/>
<EditText android:id="@+id/editText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_row="0"
android:layout_column="1"
android:ems="10"/>
<TextView android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_row="1"
android:layout_column="0"
android:text="Reg.No"
android:textSize="20sp"
android:gravity="center"/>
<EditText
android:id="@+id/editText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Downloaded by Dilpreet Kaur ([email protected])
lOMoARcPSD|23838930

| 12 P a g e

android:layout_margin="10dp"
android:layout_row="1"
android:layout_column="1"
android:inputType="number"
android:ems="10"/>
<TextView android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_row="2"
android:layout_column="0"
android:text="Dept" android:textSize="20sp"
android:gravity="center"/>
<Spinner android:id="@+id/spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_row="2"
android:layout_column="1"
android:spinnerMode="dropdown"/>

<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_row="3"
android:width="100pt"
android:layout_column="1"
android:text="Submit"
tools:ignore="MissingConstraints" />
</GridLayout>

</RelativeLayout>

MainActivity.java
package com.example.event;

import androidx.appcompat.app.AppCompatActivity ;
import android.content.Intent ;
import android.support.v4.app. *;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter ;
import android.widget.Button ;
import android.widget.EditText ;
import android.widget.Spinner ;
public class MainActivity extends AppCompatActivity {
//Defining the Views
EditText e1,e2;
Button bt;
Spinner s;

//Data for populating in Spinner
String [] dept_array={"CSE","ECE","IT","Mech","Civil"};

String name,reg,dept;

@Override
Downloaded by Dilpreet Kaur ([email protected])
lOMoARcPSD|23838930

| 13 P a g e

protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView( R.layout.activity_main);
//Referring the Views
e1= (EditText) findViewById(R.id.editText);
e2= (EditText) findViewById(R.id.editText2);

bt= (Button) findViewById(R.id.button);

s= (Spinner) findViewById(R.id.spinner);

//Creating Adapter for Spinner for adapting the dat a from array to
Spinner
ArrayAdapter adapter = new
ArrayAdapter(MainActivity.this,android.R.layout.simple_spinner_item,dept_ar
ray);
s.setAdapter(adapter);

//Creating Listener for Button
bt.setOnClickListener( new View.OnClickListener() {
@Override
public void onClick(View v) {

//Getting the Values from Views(Edittext & Spinner)
name = e1.getText().toString();
reg = e2.getText().toString();
dept = s.getSelectedItem().toString();

//Intent For Navigating to Second Activity
Intent i = new Intent(MainActivity.this,
SecondActivity.class);

//For Passing the Values to Second Activity
i.putExtra("name_key", name);
i.putExtra("reg_key", reg);
i.putExtra("dept_key", dept);

startActivity( i);
}

});
}}








Downloaded by Dilpreet Kaur ([email protected])
lOMoARcPSD|23838930

| 14 P a g e

Output..
Before.

After.

Downloaded by Dilpreet Kaur ([email protected])
lOMoARcPSD|23838930

| 15 P a g e

7. Create and Login application as above. On successful login, open browser with any
URL.
Activity_Main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

<TextView android:text = "Login" android:layout_width="wrap_content"
android:layout_height = "wrap_content"
android:id = "@+id/textview"
android:textSize = "35dp"
android:layout_alignParentTop = "true"
android:layout_centerHorizontal = "true" />
<EditText
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:id = "@+id/editText"
android:hint = "Enter Name"
android:focusable = "true"
android:textColorHighlight = "#ff7eff15"
android:textColorHint = "@color/black"
android:layout_marginTop = "46dp"
android:layout_alignParentLeft = "true"
android:layout_alignParentStart = "true"
android:layout_alignParentRight = "true"
android:layout_alignParentEnd = "true" />

<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:ems="10"
android:id="@+id/editText2"
android:layout_below="@+id/editText"
android:layout_alignParentLeft ="true"
android:layout_alignParentStart ="true"
android:layout_alignRight="@+id/editText"
android:layout_alignEnd="@+id/editText"
android:textColorHint="@color/black"
android:hint="Password" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Attempts Left:"
android:id="@+id/textView2"
android:layout_below="@+id/editText2"
android:layout_alignParentLeft ="true"
android:layout_alignParentStart ="true"
android:textSize="25dp" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Downloaded by Dilpreet Kaur ([email protected])
lOMoARcPSD|23838930

| 16 P a g e

android:text="New Text"
android:id="@+id/textView3"
android:layout_alignTop="@+id/textView2"
android:layout_alignParentRight ="true"
android:layout_alignParentEnd ="true"
android:layout_alignBottom="@+id/textView2"
android:layout_toEndOf="@+id/textview"
android:textSize="25dp"
android:layout_toRightOf="@+id/textview" />

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="login"
android:id="@+id/button"
android:layout_alignParentBottom ="true"
android:layout_toLeftOf="@+id/textview"
android:layout_toStartOf="@+id/textview" />

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Cancel"
android:id="@+id/button2"
android:layout_alignParentBottom ="true"
android:layout_toRightOf="@+id/textview"
android:layout_toEndOf="@+id/textview" />

</RelativeLayout>

MainActivity.java
package com.example.login;

import androidx.appcompat.app.AppCompatActivity ;
import android.app.Activity ;
import android.graphics.Color ;
import android.os.Bundle;
import android.view.View;

import android.widget.Button ;
import android.widget.EditText ;
import android.widget.TextView ;
import android.widget.Toast ;
public class MainActivity extends AppCompatActivity {
Button b1,b2;
EditText ed1,ed2;
TextView tx1;
int counter = 3;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView( R.layout.activity_main);

b1 = (Button)findViewById(R.id.button);
ed1 = (EditText)findViewById(R.id.editText);
ed2 = (EditText)findViewById(R.id.editText2);

b2 = (Button)findViewById(R.id.button2);
Downloaded by Dilpreet Kaur ([email protected])
lOMoARcPSD|23838930

| 17 P a g e

tx1 = (TextView)findViewById(R.id.textView3);
tx1.setVisibility(View.GONE);

b1.setOnClickListener( new View.OnClickListener() {
@Override
public void onClick(View v) {
if(ed1.getText().toString().equals( "admin") &&
ed2.getText().toString().equals( "admin")) {
Toast.makeText(getApplicationContext(),
"Redirecting...",Toast.LENGTH_SHORT).show();
}else{
Toast.makeText(getApplicationContext(), "Wrong
Credentials",Toast.LENGTH_SHORT).show();

tx1.setVisibility(View.VISIBLE);
tx1.setBackgroundColor( Color.RED);
counter--;
tx1.setText(Integer.toString(counter));

if (counter == 0) {
b1.setEnabled(false);
}
}
}
});
b2.setOnClickListener( new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
}
}

Output..

Downloaded by Dilpreet Kaur ([email protected])
lOMoARcPSD|23838930

| 18 P a g e

8. Testing mobile app - unit testing, black box testing and test automation.
When testing a mobile app, you can employ various testing techniques and methodologies, including
unit testing, black box testing, and test automation, to ensure the quality and reliability of your
application.
1. Unit Testing:
 Purpose: Unit testing is focused on testing individual components or units of code in
isolation, such as functions, classes, or methods. It helps ensure that each unit of code works
as expected.
 Scope: It doesn't test the overall functionality of the app but rather individual parts of the
codebase.
 Benefits: Unit testing helps catch and fix bugs early in the development process and
improves code maintainability.
 Tools: For Android, you can use JUnit for unit testing, which is integrated into Android
Studio. For iOS, XCTest is the standard framework for unit testing.

2. Black Box Testing:
 Purpose: Black box testing is a functional testing approach where the tester focuses on
the app's external behaviour without examining its internal code or logic.
 Scope: It tests the application as a whole, ensuring that it meets the specified
requirements and works as expected from a user's perspective.
 Benefits: Black box testing helps identify usability, compatibility, and functionality issues.
Types:
 Functional Testing: Ensures that the app's functions work correctly.
 Non-Functional Testing: Checks aspects like performance, security, and usability.
 Tools: Various tools are available for automating black box testing, such as Appium,
Calabash, and Espresso for Android and XCTest for iOS.

3. Test Automation:
 Purpose: Test automation involves writing scripts or using tools to automatically
execute test cases, increasing test coverage and efficiency.
 Scope: It can be used for both unit testing and black box testing, depending on the
level of automation.
 Benefits: Test automation accelerates testing processes, ensures repeatability, and
helps identify regressions.
Tools:
Downloaded by Dilpreet Kaur ([email protected])
lOMoARcPSD|23838930

| 19 P a g e

 Appium: An open-source tool for automating mobile app testing on Android and
iOS.
 Espresso: A testing framework for Android that allows you to write automated UI
tests.
 XCUITest: Apple's framework for automating UI tests on iOS.
 Detox: A gray box end-to-end testing framework for React Native apps.
 Robot Framework: An open-source automation framework that supports mobile
app testing.

When testing a mobile app, it's essential to have a well-rounded testing strategy that includes a
combination of unit testing, black box testing, and test automation. Unit testing ensures the
reliability of individual code components, black box testing verifies the app's functionality and user
experience, and test automation helps speed up the testing process and maintains a high level of
quality as the app evolves.


















Downloaded by Dilpreet Kaur ([email protected])
lOMoARcPSD|23838930

| 20 P a g e

9. Create an iOS application that can play audio and video files.
ViewController.h
#import <UIKit/UIKit.h>
#import <AVFoundation/AVFoundation.h>
#import <MediaPlayer/MediaPlayer.h>

@interface ViewController : UIViewController {
AVAudioPlayer *audioPlayer;
MPMoviePlayerViewController *moviePlayer;
}
-(IBAction)playAudio:(id)sender;
-(IBAction)playVideo:(id)sender;
@end

ViewController.m
#import "ViewController.h"

@interface ViewController ()
@end

@implementation ViewController

- (void)viewDidLoad {
[super viewDidLoad];
}

- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning ];
// Dispose of any resources that can be recreated.
}

-(IBAction)playAudio:(id)sender {
NSString *path = [[NSBundle mainBundle]
pathForResource:@"audioTest" ofType:@"mp3"];
audioPlayer = [[AVAudioPlayer alloc]initWithContentsOfURL :
[NSURL fileURLWithPath :path] error:NULL];
[audioPlayer play];
}

-(IBAction)playVideo:(id)sender {
NSString *path = [[NSBundle mainBundle]pathForResource:
@"videoTest" ofType:@"mov"];
moviePlayer = [[MPMoviePlayerViewController
alloc]initWithContentURL:[NSURL fileURLWithPath :path]];
[self presentModalViewController :moviePlayer animated :NO];
}
@end




Downloaded by Dilpreet Kaur ([email protected])
lOMoARcPSD|23838930

| 21 P a g e

Output..


Downloaded by Dilpreet Kaur ([email protected])
lOMoARcPSD|23838930
Tags