AndroidNotes PDF

You might also like

You are on page 1of 14

Question 1: - Structure of Android Program

 Developing an Android project, you have to install the Android plug-ins for
Eclipse and at least have some knowledge of Java programming.
 After installing all the plug-ins for an Android file, you can begin to develop an
Android Application
 Android uses packages not only to arrange the code in an application but to
manage the application themselves.

The above diagram shows the basic building blocks of an Android application.
 Android application in Eclipse or in any development tool have a pre-
defined structure with code and resource organized into a number of
folders.
Every Android project contains several folders, like:
 src : The 'src' stands for Source Code. It contains the Java Source files.
 Gen : The 'gen' stands for Generated Java Library. This library is for Android
internal use only.
 Android 2.2: The Android Framework Library is stored here.
 assets : It is used to store raw asset files.
 libs : It contains private libraries.
 res :
The 'res' stands for Resource file.
It can store resource files such as pictures, XML files, etc.
It contains some additional folders such as Drawable, Layout and Values.

anim: It is used for XML files that are compiled into animation objects.
color: It is used for XML files that describe colors.
drawable: It is used to store various graphics files. In Android project structure,

There are three types of drawable folders,


1. drawable-mdpi
2. drawable-hdpi
3. drawable-ldp

Layout : It is used for placing the XML layout files, which defines how various Android
objects such as textbox, buttons, etc. are organized on the screen.

Menu : It is used for defining the XML files in the application menu.

Raw: The 'raw' stands for Raw Asset Files.


Values: It is used for XML files which stores various string values, such as titles, labels,
etc.
Xml: It is used for configuring the application components.

 AndroidManifest.xml :
This file indicates the Android definition file.
This file contains the information about the Android application such as
minimum Android version, permission to access Android device capabilities
such as Internet access permission, phone permission etc.
 Default.properties:
This file contains the project settings, such as build the target. Do not edit this
file manually
 Proguard.cfg :
This file defines how ProGuard optimizes and makes your code unclear.
 MainLayout.xml :
This file describes the layout of the page. So all the components such as
textboxes, labels, radio buttons, etc. are displaying on the application screen.

 Activity class :
The application occupies the entire device screen which needs at least one
class inherits from the Activity class. OnCreate() method initiates the
application and loads the layout page.
_____________________________________________________________
Question 2: - What is Features Of Android
What is Android :
o Android is a software package and linux based operating system for mobile
devices such as tablet computers and smartphones.

o It is developed by Google and later the OHA (Open Handset Alliance). Java
language is mainly used to write the android code even though other languages
can be used.

o The goal of android project is to create a successful real-world product that


improves the mobile experience for end users.

What is Open Handset Alliance (OHA)

o It's a consortium of 84 companies such as google, samsung, AKM, synaptics,


KDDI, Garmin, Teleca, Ebay, Intel etc.

o It was established on 5th November, 2007, led by Google. It is committed to


advance open standards, provide services and deploy handsets using the
Android Plateform
Features of Android

o After learning what is android, let's see the features of android. The important
features of android are given below:

1) It is open-source.
2) Anyone can customize the Android Platform.
3) There are a lot of mobile applications that can be chosen by the
consumer.
4) It provides many interesting features like weather details, opening
screen, live RSS (Really Simple Syndication) feeds etc.

o It provides support for messaging services(SMS and MMS), web browser,


storage (SQLite), connectivity (GSM, CDMA, Blue Tooth, Wi-Fi etc.), media,
handset layout etc.

Android applications

o Entertainment
o Tools
o Communication
o Productivity
o Personalization
o Music and Audio
o Social
o Media and Video
o Travel and Local etc.

Question 3 : What is History of Android


The code names of android ranges from A to J currently, such
as Aestro, Blender, Cupcake, Donut, Eclair, Froyo, Gingerbread, Honeycomb, Ice
Cream Sandwitch, Jelly Bean, KitKat and Lollipop. Let's understand the android
history in a sequence.

1) Initially, Andy Rubin founded Android Incorporation in Palo Alto, California, United
States in October, 2003.
2) In 17th August 2005, Google acquired android Incorporation. Since then, it is in the
subsidiary of Google Incorporation.

3) The key employees of Android Incorporation are Andy Rubin, Rich Miner, Chris
White and Nick Sears.

4) Originally intended for camera but shifted to smart phones later because of low
market for camera only.

5) Android is the nick name of Andy Rubin given by coworkers because of his love to
robots.

6) In 2007, Google announces the development of android OS.

7) In 2008, HTC launched the first android mobile.

Version Code name

1.5 Cupcake

1.6 Donut

2.1 Eclair

2.2 Froyo

2.3 Gingerbread

3.1 and 3.3 Honeycomb

4.0 Ice Cream Sandwitch

4.1, 4.2 and 4.3 Jelly Bean

4.4 KitKat

5.0 Lollipop

6.0 Marshmallow
7.0 Nougat

8.0 Oreo

Question 4 : History of Mobile Development

What is Mobile Application :


A mobile application (or mobile app) is a software application designed
to run on smart phones, tablet computers and other mobile devices.

The history of the mobile app begins, obviously, with the history of the mobile
device and the first mobile phones whose microchips required the most basic
of software to send and receive voice calls. But since then things have got a lot
more complicated.

PSION EPOC

 First devices launched in early


90’s
 Used in Psions SIBO (Sixteen Bit
operating System ) devices
 Used OPL (Open Programming
Language )
 Formed the Basis of Symbian .
PALM OS

 Palm OS (also known as Garnet OS ) is a mobile operating System initially


developed by Palm , Inc ,
For personal digital assistants (PDAs) in 1996
 Palm OS was designed for ease of use with a touchscreen based graphical
user interface
 Formed the Basis of Symbian .

WML

 Wireless Markup Language was based on XML and HTML


 WML documents are divided into a set of cards, each representing one unit
of interaction between the user and the user agent .
 Instruction embedded within the cards may invoke services on origin
servers.
 Several cards are grouped into a deck the basic WML unit that origin server
can sent to a user agent.

J2ME/JME

 Designed for embedded System and mobile platform .


 Java ME technology was originally created in order to deal with the
constraint associated with building application for small devices.
 For this purpose Oracle defined the basics for Java ME Technology to fit
such a limited environment and make it possible to create Java Application
running on small devices with limited memory display and power capacity .
 Java ME is an Open source implementation , Mika VM ,which contains the
class libraries for implementing the Connected Device Configuration .
Symbian

 Symbian grew out of the Psion EPOC operating system.


 Originally developed by Symbian Ltd – a joint venture of Psion, Ericsson,
Motorola
and Nokia – the operating system was almost ubiquitous.
 In 2009 250 millions devices were running Symbian.
 It was Nokia that really drove the development of Symbian OS.
 The S50 platform was used on nearly all Nokia handsets as well as some
Samsung and LG Ones;
 The use of different fragmented platforms (Sony Ericsson and Motorola
used UIQ and there was MOAP(S) FOR NIT DoCoMo ) each with its own API ,
meant that there were a variety of development techniques and no
standard market place for apps.
 The incompatibility of apps across platforms and the failure to fully move to
open source (several key components were licensed from third parties) are
probably what sounded the death-knell for Symbian.
 Symbian, once the largest codebase ever moved to Open Source, is
now licence -only and Nokia’s development of the OS has been
outsourced to Accenture.
Question 5 : Difference between Android IOS Windows

___________________________________________________________________
Question 6: Android Structure
 The Linux Kernel
 Hardware Abstraction Layer (HAL)
 Android Runtime
 Native C/C++ Libraries
 Java API Framework
 System Apps

Android is an open source, Linux-based software stack created for a wide array of
devices and form factors. The following diagram shows the major components of
the Android platform.
The Linux Kernel
The foundation of the Android platform is the Linux kernel. For example, the Android
Runtime (ART) relies on the Linux kernel for underlying functionalities such as
threading and low-level memory management.

Using a Linux kernel allows Android to take advantage of key security features and
allows device manufacturers to develop hardware drivers for a well-known kernel.

Hardware Abstraction Layer (HAL)


 The hardware abstraction layer (HAL) provides standard interfaces that
expose device hardware capabilities to the higher-level Java API framework.
 The HAL consists of multiple library modules, each of which implements an
interface for a specific type of hardware component, such as
the camera or bluetooth module.
 When a framework API makes a call to access device hardware, the Android
system loads the library module for that hardware component.

Android Runtime

 For devices running Android version 5.0 (API level 21) or higher, each app runs
in its own process and with its own instance of the Android Runtime (ART).
 ART is written to run multiple virtual machines on low-memory devices by
executing DEX files, a bytecode format designed specially for Android that's
optimized for minimal memory footprint. Build toolchains, such as Jack,
compile Java sources into DEX bytecode, which can run on the Android
platform.

Some of the major features of ART include the following:

 Ahead-of-time (AOT) and just-in-time (JIT) compilation


 Optimized garbage collection (GC)
 Better debugging support, including a dedicated sampling profiler, detailed diagnostic
exceptions and crash reporting, and the ability to set watchpoints to monitor specific
fields

Prior to Android version 5.0 (API level 21), Dalvik was the Android runtime. If your app
runs well on ART, then it should work on Dalvik as well, but the reverse may not be
true.

Android also includes a set of core runtime libraries that provide most of the
functionality of the Java programming language, including some Java 8 language
features, that the Java API framework uses.
Native C/C++ Libraries

Many core Android system components and services, such as ART and HAL, are built
from native code that require native libraries written in C and C++. The Android
platform provides Java framework APIs to expose the functionality of some of these
native libraries to apps. For example, you can access OpenGL ES through the Android
framework’s Java OpenGL API to add support for drawing and manipulating 2D and
3D graphics in your app.

If you are developing an app that requires C or C++ code, you can use the Android
NDK to access some of these native platform libraries directly from your native code

Java API Framework

The entire feature-set of the Android OS is available to you through APIs written in
the Java language. These APIs form the building blocks you need to create Android
apps by simplifying the reuse of core, modular system components and services,
which include the following:

 A rich and extensible View System you can use to build an app’s UI, including lists,
grids, text boxes, buttons, and even an embeddable web browser
 A Resource Manager, providing access to non-code resources such as localized
strings, graphics, and layout files
 A Notification Manager that enables all apps to display custom alerts in the status bar
 An Activity Manager that manages the lifecycle of apps and provides a
common navigation back stack
 Content Providers that enable apps to access data from other apps, such as the
Contacts app, or to share their own data

Developers have full access to the same framework APIs that Android system apps
use.

System Apps
 Android comes with a set of core apps for email, SMS messaging, calendars,
internet browsing, contacts, and more.
 Apps included with the platform have no special status among the apps the
user chooses to install. So a third-party app can become the user's default web
browser, SMS messenger, or even the default keyboard (some exceptions
apply, such as the system's Settings app).
 The system apps function both as apps for users and to provide key capabilities
that developers can access from their own app.
 For example, if your app would like to deliver an SMS message, you don't need
to build that functionality yourself—you can instead invoke whichever SMS app
is already installed to deliver a message to the recipient you specify.

Question 7 : Life Cycle Of Android Program


Android Activity Lifecycle :
 Android Activity Lifecycle is controlled by 7 methods of android.app.Activity
class.
 The android Activity is the subclass of ContextThemeWrapper class.
 An activity is the single screen in android. It is like window or frame of Java.
 By the help of activity, you can place all your UI components or widgets in a
single screen.
 The 7 lifecycle method of Activity describes how activity will behave at different
states.

Android Activity Lifecycle methods

Method Description

onCreate called when activity is first created.

onStart called when activity is becoming visible to the user.

onResume called when activity will start interacting with the user.

onPause called when activity is not visible to the user.

onStop called when activity is no longer visible to the user.

onRestart called after your activity is stopped, prior to start.

onDestroy called before the activity is destroyed.

You might also like