0% found this document useful (0 votes)
60 views39 pages

Android Presentation

Android is an operating system that operates over 3 billion devices. Kotlin is a programming language that targets the JVM and is used for Android app development. Functions, variables, data types, control flows, classes and objects are the core components used in Kotlin to develop Android apps.

Uploaded by

Tarun Sharma
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)
60 views39 pages

Android Presentation

Android is an operating system that operates over 3 billion devices. Kotlin is a programming language that targets the JVM and is used for Android app development. Functions, variables, data types, control flows, classes and objects are the core components used in Kotlin to develop Android apps.

Uploaded by

Tarun Sharma
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/ 39

ANDROID

APP
DEVELOPM
ENT
INDUSTRIAL TRAINING
PRESENTATION
Submitted by: Submitted to:
•Tarun Sharma •Mr. Nafeesh
•roll Ahmad Sir
no.:252001003 •Department:
•Department: ECE-A
ECE-A
UIET UIETKUK
KUK
HELL
O!
My name is Tarun Sharma
from UIET KUK.
I have recently completed my
training in “Android App
Development”
From Internshala.
01 02
INTRODUCTION WORLD OF
T0 ANDROID KOTLIN

03 04
HIGHER ORDER
ANDROID KICK
FUNCTIONALITI
OFF
ES
01.INTRODU
CTION TO
ANDROID
WHAT
ANDROID
ACTUALLY IS?
Well most of us are aware of this
very fact that android is an
operating system which operates a
BUT WHAT IS
lump huge sum of over 3 billion
devices including smart phones,
OPERATING
tablets, televisions,watches,etc.
SYSTEM?
It is a software that controls the
operation of a computer and directs
the processing of programs (as by
assigning storage space in memory and
Android
Versions
There are many versions of android which appeared through
years .
Some of them are:
• •Android 1.0
• •Android 1.1
• •Android 1.5 (cup cake) – API 3
• •Android 5.0(lolly pop)
• •Android 11 (latest version)
ENVIRONMENT AND TOOLS USED TO
DEVELOP ANDROID APPS

ANDROID SOFTWARE
STUDIO DEVELOPMENT KIT
Android studio is the official SDK contains all the essential
Integrated Development libraries used to develop
Environment(IDE) for Android android apps. Android studio
app development. It has and software development kit
IntelliJ’s powerful code editor work together.
and developer tools, and
various other features that
enhance productivity while
developing Android apps.
02
WORLD OF
KOTLIN
Kotlin is a
programming
language
Target to JVM, Kotlin is a
cross platform, statically
typed, general purpose
programming language with
type inference. Kotlin is
designed to interoperate fully
with Java but type inference
allows its syntax to be more
concise. Kotlin is sponsored
by JetBrains and Google
• Every program starts executing with main
function.

• Print function is used to print material


inside bracket.

• Println() is used to print line by line


What is data and how do we
handle it?
2+3=5
Variables are like names that are used to store data. In
5*4=20 Kotlin, these are of two types:
28/7=4
1.Var: We can assign value more than once.
18-7=11 2.Val: We can assign value only once in a function.

-------------------------------------------
-----Syntax for declaring variables:
Þ Keyword identifier = initialization
Þ E.g. var note=4
Identifiers
Identifiers are the variable names that we create to store
the value of a variable.
E.g. Tarun, mobile_number, etc.

Here are the rules and conventions for naming a variable


(identifier) in Kotlin:
1.An identifier starts with a letter or underscore
followed by zero, letter and digits.
2.Whitespaces are not allowed.
3.An identifier cannot contain symbols such as @, #
etc.
Operators
Operators are symbols which are used to
perform some operations on a variable or a
set of variables.

•Arithmetic operators (+,-,*,/,%)


•Comparison operators (==,!=,<=,>=,<,>)
•Assignment operators (=,+=,-=,*=,/=,%=)
•Increment and decrement operators (+
+,--)
Stri
ng
String is a sequence of characters. It is defined by
using double quotation marks in Kotlin.

INDEX
TABLE
FOR
STRING
String
Since literals in Kotlin are implemented as instances of String class, we can use several

Functions
methods and properties of this class.

•length property - returns the length of character sequence of an string.

•compareTo function - compares this String (object) with the specified object. Returns 0 if
the object is equal to the specified object.

•get function - returns character at the specified index.

We can use index access operator instead of get function as index access operator internally
calls get function.

•plus function - returns a new string which is obtained by the concatenation of this string
and the string passed to this function.

We can use + operator instead of plus function as + operator calls plus function under the
hood.

•subSequence Function - returns a new character sequence starting at the specified start and
Example
program for
string
functions
User Defined
Functions
Functions are a collection of code that returns some result.
Functions can combine a group of activities, represented
by a single name called the function name. They are the
most basic ways to organise programs.

fun
-Functions only have a single word. E.g. Tarun,
callme(arg1,arg2)
Tarun_sharma, etc. callme()
{
Calling a
//function body
user-
} Creating a
user- defined
defined functions
Arra
ys
An array is a data structure that contains a group of
elements.

In Kotlin, once we declare an array, we can only


change the value of its elements. Its size can not be
changed.
Conditi
onals
1.If-else statements: when (x)2.When
expressions:
val max = if (a > {
b) 1 -> print("x ==
{ 1")
print("Choose a") 2 -> print("x ==
a 2")
} else -> {
else print("x is
{ print("Choose neither 1 nor 2")
b") b }
}
LOOPS

Do-While
FOR loop While Loop
Loop
The FOR loop iterates While checks the condition & Executes the body and
through anything that if satisfied, executes the body then checks condition.
provides an iterator and returns to the condition
check

Kotlin supports traditional BREAK and


CONTINUE statements.
LISTS
1.Immutable List 2.Mutable List

•Elements can not be added or altered in immutable lists. can be added as well as
•Elements
altered in mutable lists.
•Defined using listOf() keyword.
•Defined using mutableListOf()
keyword.
•var/val listName=listOf<datatype>(list_of_items).
•var/ val
listName=mutableListOf<datatype>(list_
of_items).
ERRORS AND EXCEPTIONS
Errors occur while compiling/executing code due to
incorrect sequence or incorrect logic.
------------------------------------------------------------------
--
try
Using thecode
{ // some try-catch block to handle
exceptions:
}
catch (e: Checks
SomeException) the code
{ // handler
} Runs, if
finally correct
{
// optional finally block Runs, if
Classes in Kotlin
What is OOP?
OOP stands for Object Oriented Programming is a
programming paradigm which uses objects
and classes to organise, structure and optimise the code.

What are classes?


Classes are the blue print for the objects having similar
properties. We need to define a class before creating object
and ‘class’ keyword is used to define a class
SYNTAX FOR
class ClassName{ //class header CLASS
//property DECLARATION
Construc
tors is a special kind of member function that is used
A constructor
to initialize the state or properties of the newly created objects
of a class.

The constructor is written inside the class, but it gets invoked


when you create an instance of the class i.e., object.
PRIMARY SECONDARY
CONSTRUCTORS CONSTRUCTORS

-A class can have only one -A class can have multiple


primary constructor. secondary constructors.
-It is part of class -It is part of class body. It is
initialised inside _init_ block
definition.
INHERIT
ANCE
Inheritance is an important feature of Object Oriented
Programming. It enables code reusability, it allows all the
features from an existing class(base class) to be inherited by
a new class(derived class). In addition the derived class can
also add some features of its own.

open class BaseClass(x : Int){


…….
} SYNTAX
class derivedClass(x : Int){ OF
……. INHERIT
03.
Android Kick
Off
ACTIVITY AND ITS
LIFECYCLE
An activity is a screen on your
devices, which consists of the
user interface.
An activity provides the
window in which the app draws
its UI. An activity has different
states like create, pause,
stop, destroy, etc.

When an activity enters a


particular state, the
method related to that
state is called.
Callbacks or methods in the
activity lifecycle

KOTLIN AND XML WORK
onCreate()
TOGETHER TO FORM AN
• onStart()
ACTIVITY.

onResume
XML IS RESPONSIBLE FOR
()
LAYOUT.

onPause()
KOTLIN IS RESPONSIBLE
• onStop()
FOR LOGIC.
BASICS OF
• CodeXML
in XML is written using tags.

<Tag>……</Tag.
e.g. <LinearLayout></LinearLayout>

• There are parent and child tags in XML. Parent


tags have child tags inside them.

<LinearLayout
Syntax
android:width=“match_parent”
android:height=“match_parent”>
of
</LinearLayout> XML
VIEW AND
VIEWGROUP
A layout defines the structure in which the various
OBJECTS
elements on the screen or the activity will be arranged.

All the elements in a layout are built using a hierarchy of


View and ViewGroup objects.
VIEW VIEWGROUP
-A View object is -ViewGroup objects
something that is are invisible
drawn and that the objects that contain
user interacts with. It other View and
is a concrete element ViewGroup objects.
on the screen that is -They are called
visible to the user. layouts.
ADDING CLICK LISTENERS TO
THE ELEMENTS
Sharing Data
Between
Data Activities
is shared between two
activities using ‘Intent’
Other
Layouts
1.Linear Layout: ViewGroup that aligns all the
children in a single direction, vertically or
horizontally.

2.Relative Layout: Relative Layout is a view


group that displays child views in relative
positions.

3.Table Layout: Table Layout is a view that


groups into rows and columns
Application Programming
Interface(API)
An application programming
interface, or API, enables us to
open up our applications’ data and
functionality to external third-party
developers, business partners, and
internal departments within their
companies. This allows services
and products to communicate with
each other and leverage each
other’s data and functionality
through a documented interface.
Volley API and its
application
1.Add the following dependency to app’s build.gradle file:
dependencies{
…..
implementation(“com.android.volley:volley:1.2.1”)
}

2.Add the Internet Permission:android.permission.INTERNET

3.Use new Request Queue:


HIGHER ORDER
FUNCTIONALITIES
Kotlin language has superb support
for functional programming. Kotlin
functions can be stored in variables
and data structures, passed as
arguments to and returned from other
higher-order functions.

 In Kotlin, a function which can


accepts a function as parameter or can
returns a function is called Higher-
Order function. Instead of Integer,
Reference
Kotlinlang.org
Android.com
THANK
YOU!
For listening
keenly.

You might also like