Unit-1.1 Getting Started with Android (1)
Unit-1.1 Getting Started with Android (1)
Development
Unit:1.1
Android: Introduction, Activities, Fragments, Intents
Introduction
“Anytime – Anywhere – Anything”
What is Android?
Android is an open source operating system and programming
platform developed by Google for mobile phones and other
mobile devices, such as tablets.
It can run on many different devices from many different
manufacturers.
Android includesa softwaredevelopment kit (SDK) that
helps you write original code and assemble software modules to
create apps for Android
users.
Android also provides a marketplace to distribute apps. All
together, Android represents an ecosystem for mobile apps.
Introduction
Why develop apps for Android?
• Developers create apps for a variety of reasons.
• They may need to address business requirements or build new
services or
businesses, or they may want to offer games and other types of
content for
users.
• Developers choose to develop for Android in order to reach the
majority of mobile device users.
Most popular platform for mobile apps
• As the world's most popular mobile platform, Android powers
hundreds of
millions of mobile devices in more than 190 countries around the
world.
• It has the largest installed base of any mobile platform and is still
growing fast. Every day another million users power up their Android-
powered devices for the first time and start looking for apps, games,
Introduction
Best experience for app users
Android provides a touch screen user interface (UI) for interacting
with apps. Android's UI is mainly based on direct manipulation.
People use touch gestures such as swiping, tapping, and pinching
to manipulate
on-screen objects.
In addition to the keyboard, there's a customizable on-screen
keyboard for text
input.
Android can also support game controllers and full-size physical
keyboards connected by Bluetooth or USB.
The Android home screen can contain several panes of app icons,
which launch
their associated apps.
Home screen panes can also contain app widgets, which display live,
auto- updating content such as the weather, the user's email inbox,
Introduction
• The Android platform, based on the Linux kernel, is designed
primarily for touch screen mobile devices such as mobile
phones and tablets.
• Because Android-powered devices are usually battery-powered,
Android is designed to manage processes to keep power
consumption at a minimum, providing longer battery use.
Android Features
• It’s an open source and we can customize the OS based on our
requirements.
• It support a connectivity for GSM, CDMA, WIFI, NFC,
Bluetooth, etc. for telephony or data transfer.
• It will allow to make or receive a calls / SMS messages and we
can send or retrieve a data across mobile networks.
• By using WIFI technology we can pair with other devices using
apps
• Android have a multiple APIs to support a location-based services
such as GPS
• We can perform all data storage related activities by using light
weight database
SQLite.
• It have a wide range of media supports like AVI, MKV, FLV, MPEG4
etc. to play or record variety of audio / video and having a different
Android Features
• It has an extensive support for multimedia hardware control
to perform playback or recording using camera and
microphone
• It has an integrated open source webkit layout based web
browser to support HTML5, CSS3
• It supports a multi-tasking, we can move from one task
window to another
and multiple applications can run simultaneously .
• It will give a chance to reuse the application components
and the replacement of native applications.
• We can access the hardware components like Camera,
GPS, and
Accelerometer
Android History
• Initially Google launched a first version of Android platform on Nov
5, 2007.
• From that onwards Google released a lot of android versions under
a codename based on desserts, such as Apple Pie, Banana Bread,
Cupcake, Donut, Éclair, Froyo, Gingerbread, Jellybeans, Kitkat,
Lollipop, marshmallow, etc. and made a lot of changes and
Release Date Version API Level Version Name
additions to the android platform.
September 23, 2008 Android 1.0 1 Apple Pie
February 9, 2009 Android 1.1 2 Banana Bread
April 30, 2009 Android 1.5 3 Cupcake
September 15, 2009 Android 1.6 4 Donut
October 26, 2009 Android 2.0 5
December 3, 2009 Android 2.0.1 6 Eclair
January 12, 2010 Android 2.1 7
Android History
Release Date Version API Level Version Name
May 20, 2010 Android 2.2 8
January 18, 2011 Android 2.2.1 8
Froyo
January 22, 2011 Android 2.2.2 8
November 21, 2011 Android 2.2.3 8
December 6, 2010 Android 2.3 9
February 9, 2011 Android 2.3.1 9
Gingerbread
July 25, 2011 Android 2.3.3 10
September 2, 2011 Android 2.3.4 10
February 22, 2011 Android 3.0.x 11
May 10, 2011 Android 3.1.x 12 Honeycomb
July 15, 2011 Android 3.2.x 13
October 18,2011 Android 4.0 14
October 19, 2011 Android 4.0.1 14 Ice Cream
Sandwich
November 28, 2011 Android 4.0.2 14
Android History
Release Date Version API Level Version Name
December 16, Android 4.0.3 15 Ice Cream Sandwich
2011
February 4, 2012 Android 4.0.4 15
July 9, 2012 Android 4.1 16
July 23, 2012 Android 4.1.1 16
October 9, 2012 Android 4.1.2 16
November 13, Android 4.2 17 Jelly Bean
2012
November 27, Android 4.2.1 17
2012
February 11, 2013 Android 4.2.2 17
July 24, 2013 Android 4.3 18
October 31, 2013 Android 4.4 19
Android 4.4.1, 4.4.2, Kitkat
June 23, 2014 19
4.4.3,
4.4.4
October 17, 2014 Android 5.0 21
Android History
Release Date Version API Level Version Name
October 5, 2015 Android 6.0 23
Marshmallow
December 7, 2015 Android 6.0.1 23
August 22, 2016 Android 7.0 24
Nougat
October 4, 2016 Android 7.1 25
August 21, 2017 Android 8.0 26
Oreo
December 5, 2017 Android 8.1 27
August 6, 2018 Android 9.0 28 Pie
September 3, 2019 Android 10.0 29 Q-
September 8, 2020 Android 11.0 30 R – Red Velvet
cake
October 4, 2021 Android 12.0 31 Snow Cone
March 7, 2022 Android 12L 32 Snow Cone v2
Q3 2022 Android 13 33 Tiramisu
September 3, 2024 Android 15 Vanilla icecream
Key platform components
Key platform components
• The Android platform can be broken down into five
sections:
■ Applications
■ Application framework
■ Middleware libraries
■ Operating system
Applications
• You will find all the Android application at the top layer. You will
write your
application to be installed on this layer only.
Android - Application Components
• Application components are the essential building blocks of
an Android application.
• These components are loosely coupled by the application
manifest file AndroidManifest.xml that describes each
component of the application and how they interact.
Components Description
Activities They dictate the UI and handle the user interaction to the
Smartphone screen
res/drawable-hdpi This is a directory for drawable objects that are designed for
high-density screens.
res/layout This is a directory for files that define your app's user interface.
res/values This is a directory for other various XML files that contain a
collection of resources, such as strings and colours definitions.
AndroidManifest.xml This is the manifest file which describes the fundamental
characteristics of the app and defines each of its components.
Build.gradle This is an auto generated file which contains compileSdkVersion,
buildToolsVersion, applicationId, minSdkVersion,
targetSdkVersion, versionCode and versionName
The Main Activity File
• file which ultimately gets converted to a ART Android Run Time – The
main activity code is a Java file MainActivity.java. This is the actual
application successor of Dalvik VM) and runs your application. Following is
the default code generated by the application wizard for Hello World!
application −
package com.example.helloworld;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends
AppCompatActivity {
protected void onCreate(Bundle savedInstanceState)
{ super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
• Here, R.layout.activity_main refers to the activity_main.xml file
located in the res/layout folder.
• The onCreate() method is one of many methods that are figured when
The Manifest File
• Whatever component you develop as a part of your application,
you must declare all its components in a manifest.xml which
resides at the root of the application project directory.
• This file works as an interface between Android OS and your
application, so if you do not declare your component in this file,
then it will not be considered by the OS.
• For example, a default manifest file will look like as following file
−
The Manifest File
Following is the list of tags which you will use in your manifest file
to specify different Android application components −
• <activity>elements for activities
raw/ Arbitrary files to save in their raw form. You need to call
Resources.openRawResource() with the resource ID, which is R.raw.filename to
open such raw files.
values/ arrays.xml for resource arrays, and accessed from the R.array class.
integers.xml for resource integers, and accessed from the R.integer class.
bools.xml for resource boolean, and accessed from the R.bool class.
colors.xml for color values, and accessed from the R.color class.
dimens.xml for dimension values, and accessed from the R.dimen class.
strings.xml for string values, and accessed from the R.string class.
styles.xml for styles, and accessed from the R.style class.
xml/ Arbitrary XML files that can be read at runtime by calling Resources.getXML().
You can save various configuration files here which will be used at run time.