0% found this document useful (0 votes)
42 views78 pages

Pre-Requisites: ITE Will Be Able To

This document provides information about the ITE 2152 module offered at a university. The module is worth 2 credits and has prerequisites of ITE 1122. Upon successful completion, students will be able to develop mobile applications for contemporary mobile operating systems. Assessment includes take-home assignments, discussion forums, quizzes, and an exam. Required readings cover beginning Android programming and professional mobile application development. The document also discusses mobile operating systems, applications, and differences between native and hybrid applications.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views78 pages

Pre-Requisites: ITE Will Be Able To

This document provides information about the ITE 2152 module offered at a university. The module is worth 2 credits and has prerequisites of ITE 1122. Upon successful completion, students will be able to develop mobile applications for contemporary mobile operating systems. Assessment includes take-home assignments, discussion forums, quizzes, and an exam. Required readings cover beginning Android programming and professional mobile application development. The document also discusses mobile operating systems, applications, and differences between native and hybrid applications.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 78

ITE

2152
• Number of credits: 2 Pre-requisites: ITE
1122
• On successful learning of this module you
will be able to:
1. Use mobile development environment
to effectively develop mobile
applications.
2. Develop moderately complex mobile
applications for contemporary mobile operating
systems.
Assessment
Plan
Assessment Method Description Weight
Continuous Assessment Take Home 10%
Assignment 01
Discussion forums 5%
Take Home 20%
Assignment 02
Quiz 5%
Exam 60%
Required
Readings
1. Beginning Android Programming with
Android Studio. J. F. DiMarzio (2016)

2. Professional Mobile Application Development


.Jeff McWherter and Scott Gowell (2012)
Mobile Operating
Systems
• Among the Mobile operating systems Android
is the most popular one among people around.
Mobile
Applications
• Before the widespread adoption of mobile devices,
software was first developed to run on desktops and
laptops.

• Tablet and smart phone usage is higher than that of


desktop computers and laptops.

• The usage of the smart phone market has increased a


lot in recent years and native app vs hybrid app
development is also the most debate topic for app
developers in present times.
Native vs
Hybrid
Native
Applications
• The native mobile app development is a process
that helps in creating apps for iOS, Windows,
Android, and Blackberry.
• The apps developed on native platform will work
only on a particular operating system.
• This means the developer should create different
versions of an app for different systems.
• The native apps provide optimized performance
and they take advantage of the latest technology
such as GPS.
Native Applications
contd.
• The developers write code in Swift or Objective-C for
iOS applications, Java for Android Native applications
and C# for Windows.
• The construction of app, design, graphic styles, visual
effects, data entry, etc. everything varies between the
operating systems.
• The native apps are capable of accessing the features
that are present in the mobile quickly like microphone,
camera, location detection, etc.
• The native apps give much better user experience
when compared to hybrid apps.
Hybrid
Applications
• In Hybrid app, one app will be created for different
platforms.
• These means be it iOS, Android, Windows or
Blackberry, only one app is enough to serve all the
purposes.
• The hybrid apps are a combination of native apps
and web apps together.
• A single product is enough to work on all the
operating systems.
Hybrid Applications
contd.
• These apps may look and feel like a native
application, but the fact is that these apps are run
by a website.
• The languages that are usually used in hybrid app
development are CSS, HTML5, and JavaScript.
• It is simply a web-based app that is put in the
native app shell and connected to the device’s
hardware.
• These hybrid apps are cost-effective .
Hybrid app vs Native app
pros and
cons
Native App
Advantages
Smooth Performance
• As the app is made only for a specific operating system,
it works smoothly.
High Spees
• The application is optimized according to the requirements
of a specific platform. This way it will achieve higher
marks in both speed and performance.
Better User Experience
• User experience matters a lot and the native apps
give smooth and better user experience.
Flexibility
• The native apps provide access to various inbuilt devices
such as GPS, camera, calendar and some other functions
of the mobile.
Native App
Disadvantages
Comparatively High Development Cost
• The developers usually have expertise in
developing apps for only a project. This way if you
need an app for various types of platforms, you
have to get numerous developers working on them.
This scenario will surely increase your budget.
Comparatively High Development Time
• Native apps require more time for development
when compared to hybrid apps. Creating an app
according to the requirements of one particular
operating system is not easy.
Hybrid App
Advantages
Decreased Cost of Development
• There is no need for you to hire multiple programmers
to work on various OS platforms.
Low Maintenance
• The hybrid apps are web applications in a native
nutshell. You will be able to update the content as
many times as you want, and it needs very low
maintenance.
Less Time for Development
• The hybrid native apps don’t take a lot of time during
development.
Hybrid App
Disadvantages
Poor Performance
• The Hybrid apps add an extra layer between source
code and target mobile platform likely the hybrid
mobile framework. This can result in performance
loss.
Difficulty in Debugging
• The extra layer causes some big issues with the
debugging too. The developers have to rely on the
framework itself to work nicely on the targeted
operating system without introducing any kind of bugs
in the app.
Less User Experience
• The user experience lacks in hybrid app development.
What is
android?
• Android is a mobile operating system based on a
modified version of the Linux kernel and other
open source software, designed primarily for touch
screen mobile devices such as smartphones and
tablets.
Versions in
Android
(Dessert names)
Latest
Version
• The initial version of Android 10.0 was released on
September 3, 2019 on Google’s Pixel devices.
• Unlike previous versions of Android, this version
doesn’t have a dessert name—or any other type of
name beyond the version number.
• It’s just “Android 10.”
• Google still plans to use dessert names internally
for development builds.
Check Android
Version
To find out the version of Android that is currently
running on your device, please try the following steps:

• From the home screen, press the Settings Button


• Then select the System option
• Scroll down and select About Phone
• Scroll down to Android Version
• The small number with the heading is the version
number of the Android operating system on the
device.
Introduction

• Java and XML are the two main


programming languages used in Android App
development.
Simple Java
Program
• Java program needs a ‘main’ class and
‘main’ method.
• Main class puts a name to the program and
starts it.
• Main method tells the interpreter to run the
class.
File Name : Hello.java
• public : declares that the method as
unprotected
.That method can be accessible to all.

• static: declares this method as one that belongs to


the entire class and not a part of any object of the
class. main must always declared as static as
interpreter uses this method before any objects.

• void: states that the main method does not return


any value, but print some text on the screen
Questio
n
• Write a complete java program to display
the following Message.
Answer

public class FirstJavaProgram


{
public static void main (Strings[] args)
{
System.out.println(“This is a JAVA
Program”);
}
}
Variables

•Variables are used to store values.


•Variables must be declared before using in the
program.

Ex:
type variable_name;
type variable_name,
variable_name,variable_name;
Declare
1/14/2020 26
Rules of variable naming in Java
• Should not begins with a digit.

• Case sensitive.

• Should not be a keyword.

• White space is not allowed in between to words.

•Variable names should be meaningful and can be of any


length.
Constants
• in
A constant reJfearsvtoafixed values that do not
change during the execution of the program.

• Java constants are normally declared in ALL


CAPS.

•Words in Java constants are normally separated by


underscores.

•To make a constant variable static final keywords


are used.
Primitive Data
Types
There are exactly eight primitive data types in Java.

•Four of them represent integers:


byte (class Byte), short (class Short), int (class Integer),
long (class Long)
• Two of them represent floating point numbers:
float (class Float), double (class Double)
• One of them represents characters:
char (class Character)
• One of them represents boolean (logical) values:
boolean (class Boolean)
Data Type
Sizes Type Bytes
Integral Numbers byte 1
short 2
int 4
long 8
Real Numbers float 4
double 8
Character char 2
Boolean boolean 1
Variable
Initialization
• Assigning value to a variable for the first time
is called initialization.
data_type
variable_name = value;
Ex:
int total = 10;
Type conversion in
• When youJava
assign value of one data type to another, the two
types might not be compatible with each other.

• If the data types are compatible, then Java will perform the
conversion automatically known as Automatic Type
Conversion and if not then they need to be casted or
converted explicitly.

• Automatic Type conversion takes place when two data types


are automatically converted. This happens when:
1. The two data types are compatible.
2. When we assign value of a smaller data type to a
bigger data type.
Automatic Type
Conversion
• Example
Size 1 byte
byte b =1;
00000001
int i = 00000000 00000000 00000000 00000001
b;
Size 4 byte
• As the size of the int is larger than byte there is
no data loss. Types are compatible. So this type
of conversions are possible.
Explicit
Conversion
• If we want to assign a value of larger data type to a
smaller data type we perform explicit type casting
or narrowing.
• This is useful for incompatible data types where
automatic conversion cannot be done.
• Here, target-type specifies the desired type to
convert the specified value to.
Explicit type
conversion

• Example
Size 4 byte

int b =300;
byte i = b; // won’t
compile

Size 1 byte

• As the size of the byte is smaller than int so


there is a data loss. Then the program gives an
Explicit type conversion
contd.
• If there is a situation where we are aware of the
data lost and still want to do the conversion, we
have to prefix the variable with target data type.
• Example
int i =1;
byte b =(byte) i ;
Non-compatible type
conversion
• Example
string s = “1”;
int i = (int) s ; //
won’t compile

Converting string to a int type is


incompatible. Then we have to use Parse
method
Non-compatible type
conversion contd.
• Example
string s = “1”;
int i = Integer.parseInt(s);

• All the primitive types has the parse


method.
Arithmetic
Operators
Important logic
🠜a += b is equivalent to a = a + b

🠜a = +b is equivalent to a = b

🠜a++ and ++a both inc rement a by 1.


🠜The difference is that a++ returns the value of a before the
increment
🠜++a returns the value after the increment.
🠜a = 10; whereas
🠜b = ++a;
🠜a = 10; //a = 11, b = 11
🠜b = a+
+;
//a = 11, b =
10
Relational
Operators
Logical
Operators
Main steps in getting user
inputs
from keyboard
• Import java library package

importjava.util.Scanner;
• use scanner function to get keyboard inputs

Scanner sc = new Scanner(System.in);

•Display message requesting user input


System.out.println("enter an name);

•Store the keyboard input into a variable


String name =
Method Description

public String next() It returns the next token from the scanner.

public String nextLine() It moves the scanner position to the next


line and returns the value as a string.

public byte nextByte() It scans the next token as a byte.

public short nextShort() It scans the next token as a short value.

public intnextInt() It scans the next token as an int value.

public long nextLong() It scans the next token as a long value.

public float nextFloat() It scans the next token as a float value.

public double nextDouble() It scans the next token as a double value.


Questio
n
• Write a complete JAVA Program to subtract
two numbers.

• Declare two variables called num1 and num2


and assign 75 and 65 as values.

• Subtract num2 from num1 and print the results .


Answer
02
public class JavaApplication2
{

public static void main(String[] args)


{
int num1=75;
int

num2=65;

System.out.println("number 1= "+ num1 );


System.out.println("number 2= "+ num2 );
System.out.println("Results="+ (num1-num2));
}
}
Questio
n
• Write a complete JAVA program to input two
integer values from keyboard and calculate the
summation of those two numbers and print the
results.
Answer
03java.util.Scanner;
Import

public class JavaApplication3


{

public static void main(String[] args)

{ int num1,num2;
Scanner user_input= new
Scanner(System.in);

System.out.print("Enter number 1= ");


num1=user_input.nextInt();

System.out.print("Enter number 2= ");


num2=user_input.nextInt();
System.out.println("Results= "+(num1+num2)); }
}
Conditional

if to Statements
specify a block of code to be executed,
if a specified condition is true

else to specify a block of code to be
executed, if the same condition is false

else if to specify a new condition to test, if the
first condition is false

switch to specify many alternative blocks of
code to be executed
if
if (condition)
Statement
{
// block of code to be executed if the condition is
true
}


if is in lowercase letters. Uppercase letters (If or
IF) will generate an error.
else
if (condition) Statement
{
// block of code to be executed if the
condition
is true
} else
{
// block of code to be executed if the
condition
is false
}
else if
if (condition1) { Statement
// block of code to be executed if condition1 is
true
} else if (condition2) {
// block of code to be executed if the condition1
is false and condition2 is true
} else {
// block of code to be executed if the condition1 is
false and condition2 is false
}
Switch
Statements
switch(expression) {
case x:
// code block
break;
case y:
// code block
break;
default :
// code block
}
Switch Statements
Contd.
This is how it works:
• The switch expression is evaluated once.
• The value of the expression is compared with
the values of each case.
• If there is a match, the associated block of code
is executed.
• The break and default keywords are optional,
and will be described later in this chapter
Questio
n
• Write a Java program to get a number from the
user and print whether it is positive or
negative.
Questio
n
• Write a Java program to find the number of days
in a month when user input month and year.
Loops
• Loops can execute a block of code as long as
a specified condition is reached.

• Types of Loops

1. For loop
2. While loop
3. Do While loop
For
ForLoop
loop executes a set of statements repeatedly until
a specified condition evaluates to false.
FOR LOOP has 3
parts
• Initialization

Executes once, initializes the loop variable which


causes the loop to iterate

• Condition

Specifies the expression which evaluates to true /


false. When this condition becomes false, the loop is
terminated.
• increment/decrement
Executes at every iteration of the loop, causes
the loop variable either to increment or
decrement.
while
Looploop executes a set of statements repeatedly until a
While
given condition remains true.
Do - while
Loop
Do while loop is similar to that of the while loop except that the
condition is evaluated at the end of the loop in do-while whereas in
while loop, it is evaluated before entering into the loop.
Questio
n
• Write a program to print numbers from 1 to
10.
Questio
n
• Write a program that prompts the user to input a
positive integer. It should then print the
multiplication table of that number.
import java.util.Scanner;
public class Table {
public static void main(String[] args)
{ Scanner console = new
Scanner(System.in); int num;
System.out.print("Enter any positive integer:
");
num = console.nextInt(); System.out.println("Multiplication Table
of " + num);
for(int i=1; i<=10; i++) {
System.out.println(num +" x " + i + " = " + (num*i) );
}
}
}
Questio
n
• Write a do-while loop that asks the user to enter
two numbers. The numbers should be added and
the sum displayed. The loop should ask the user
whether he or she wishes to perform the operation
again. If so, the loop should repeat; otherwise it
should terminate.
import java.util.Scanner;
public class SumAgain {
public static void
main(String[] args) {
Scanner console = new Scanner(System.in);
int number1, number2; char choice;
do {
System.out.print("Enter the first number ");
number1 = console.nextInt();
System.out.print("Enter the second number ");
number2 = console.nextInt();
int sum = number1 + number2;
System.out.println("Sum of numbers: " + sum);
System.out.print("Do you want to continue y/n? ");
choice = console.next();
}while(choice=='y' || choice == 'Y');
}
}
Java
Arrays
• Variables that hold only one value.

• Arrays are objects which store multiple variables of the same


type.

• The positions in an array start at 0 and go up sequentially.

• Store only fixed size of elements in the array.


Types of Arrays in
Java
• Single Dimensional
Array
• Multidimensional Array
Single Dimensional
Declare anArray
Array in
java
• dataType[] arr; (or) Example: int[] arr; //Preferred
• dataType []arr; (or) int arr[];
• dataType arr[]; int
[]arr;
Instantiation of an Array with a size in java

• arr = new datatype[size]; arr = new


int[10];
Array Declaration & Initiation

• int arr[] = new int[6];

Add Elements to array positions

• arr[0] = 1;
• asrr[1]=2;

Create an array with elements

• int arr[]={1,2,3,4,5,6};

Array elements can be accessed with the help of the index.


Ex: arr[0] refers to 1
arr[1] refers to 2
Get the size of
array

• arr.length

Print an array in java


int arr[]={2,3,4,5};

for(int i=0;i<a.length;i++){
System.out.println( arr[i] );
}
Questio

n
Write a Java program to find the count of even and odd integers
in the array of integers.

number_Array = [1, 2, 3, 4, 5, 6, 7, 8, 9]
Answer
Questio
n
Define an array to store Marks of 5 students entered by the
user. Write a complete java program to do following task.

• Calculate and print the class average mark.


Answer
Thank
You

You might also like