N3886 Android Programming BCA Science Sem 6
N3886 Android Programming BCA Science Sem 6
N3886 Android Programming BCA Science Sem 6
Android Programming
For
B.C.A. Science : Semester - VI
Price ` 200.00
N3886
Android Programming ISBN 978-93-88897-20-4
First Edition : February 2019
© : Authors
The text of this publication, or any part thereof, should not be reproduced or transmitted in any form or stored in any computer storage system or device for
distribution including photocopy, recording, taping or information retrieval system or reproduced on any disc, tape, perforated media or other information storage
device etc., without the written permission of Authors with whom the rights are reserved. Breach of this condition is liable for legal action.
Every effort has been made to avoid errors or omissions in this publication. In spite of this, errors may have crept in. Any mistake, error or discrepancy so
noted and shall be brought to our notice shall be taken care of in the next edition. It is notified that neither the publisher nor the authors or seller shall be
responsible for any damage or loss of action to any one, of any kind, in any manner, therefrom.
Published By : P.O.D.
NIRALI PRAKASHAN STAR COPIERS PVT. LTD.
Abhyudaya Pragati, 1312, Shivaji Nagar Kumthekar Road, Sadashiv Peth
Off J.M. Road, PUNE – 411005 Pune - 411 030
Tel - (020) 25512336/37/39, Fax - (020) 25511379 Tel - (020) 24479201
Email : [email protected]
DISTRIBUTION CENTRES
PUNE
Nirali Prakashan : 119, Budhwar Peth, Jogeshwari Mandir Lane, Pune 411002, Maharashtra
(For orders within Pune) Tel : (020) 2445 2044, 66022708, Fax : (020) 2445 1538; Mobile : 9657703145
Email : [email protected]
Nirali Prakashan : S. No. 28/27, Dhayari, Near Asian College Pune 411041
(For orders outside Pune) Tel : (020) 24690204 Fax : (020) 24690316; Mobile : 9657703143
Email : [email protected]
MUMBAI
Nirali Prakashan : 385, S.V.P. Road, Rasdhara Co-op. Hsg. Society Ltd.,
Girgaum, Mumbai 400004, Maharashtra; Mobile : 9320129587
Tel : (022) 2385 6339 / 2386 9976, Fax : (022) 2386 9976
Email : [email protected]
DISTRIBUTION BRANCHES
JALGAON
Nirali Prakashan : 34, V. V. Golani Market, Navi Peth, Jalgaon 425001, Maharashtra,
Tel : (0257) 222 0395, Mob : 94234 91860; Email : [email protected]
KOLHAPUR
Nirali Prakashan : New Mahadvar Road, Kedar Plaza, 1st Floor Opp. IDBI Bank, Kolhapur 416 012
Maharashtra. Mob : 9850046155; Email : [email protected]
NAGPUR
Nirali Prakashan : Above Maratha Mandir, Shop No. 3, First Floor,
Rani Jhanshi Square, Sitabuldi, Nagpur 440012, Maharashtra
Tel : (0712) 254 7129; Email : [email protected]
DELHI
Nirali Prakashan : 4593/15, Basement, Agarwal Lane, Ansari Road, Daryaganj
Near Times of India Building, New Delhi 110002 Mob : 08505972553
Email : [email protected]
BENGALURU
Nirali Prakashan : Maitri Ground Floor, Jaya Apartments, No. 99, 6th Cross, 6th Main,
Malleswaram, Bengaluru 560003, Karnataka; Mob : 9449043034
Email: [email protected]
Other Branches : Hyderabad, Chennai
Note : Every possible effort has been made to avoid errors or omissions in this book. In spite this, errors may have crept in. Any type of error or mistake so noted,
and shall be brought to our notice, shall be taken care of in the next edition. It is notified that neither the publisher, nor the author or book seller shall be responsible
for any damage or loss of action to any one of any kind, in any manner, therefrom. The reader must cross check all the facts and contents with original Government
notification or publications.
[email protected] | www.pragationline.com
Objectives…
After reading this chapter you will be able,
• To learn Basic Concepts of Android Operating System
• To understand History, Versions and Architecture of Android Operating System
• To study JDK, SDK, ADT, Emulator in Android
• To study Android Studio with its Screen Elements
• To develop Android Applications using Android Studio
1.1 OVERVIEW
• Technology begets more technology, and new technologies proliferate with ever-increasing speed.
Some of these new technologies will survive beyond a few years, but most will not.
• There is little worse than investing time and energy in acquiring a new skill that is obsolete on arrival
or whose utility is short-lived. In this era, most of the people want to use smart devices for
communication, planning and organizing their schedule for their private and professional life.
1.1
Android Programming (BCA Science : VI) Introduction to Android
• These technologies are causing dramatic changes in the organization of information system. Android
has been changed in smart device market. Android is a new generation mobile OS which runs on
Linux kernel.
• Android device application developed is based on Java Programming. These codes are used to control
smart device via Google–enabled java libraries. It is an important platform to develop mobile device
application using software stack provided in the Google Android SDK.
• Android combines Operating System features like structured shared memory, preemptive multi-
tasking, Unix User Identifiers (UIDs) and file permission with Java language and its class library. The
Security platform is much better than J2ME or Blackberry Platforms.
• Programs can typically neither read nor write each other’s code. The software developers at mobile
development India have expertise in developing application based on Android java libraries.
• Android is an open-source operating system named Android Inc. Google has made the code for all the
low-level "stuff" as well as the needed middleware to power and use an electronic device, and gave
Android freely to anyone who wants to write code and build the operating system from it. There is
even a full application framework included, so third-party apps can be built and installed, then made
available for the user to run as they like.
1.2 HISTORY
• Android is a mobile operating system developed by Google, based on a modified version of the Linux
kernel and other open source software and designed primarily for touch screen mobile devices such
as smart phones and tablets.
• In addition, Google has further developed Android TV for televisions, Android Auto for cars, and
Wear OS for wrist watches, each with a specialized user interface. Variants of Android are also used
on game consoles, digital cameras, PCs and other electronics.
• Initially developed by Andy Rubin founded Android Incorporation in Palo Alto, California, United
States in October, 2003, which Google bought in 2005, and Android was unveiled in 2007, with the
first commercial Android device launched in September 2008.
• The version history of the Android mobile began with the public release of the Android beta on
November 5, 2007. The first commercial version, Android 1.0, was released on September 23, 2008.
Android is continually developed by Google and the Open Handset Alliance (OHA) and it has seen a
number of updates to its base operating system since the initial release. OHA is a business alliance
that consist of 47 companies like Google, HTC, LG Electronics, Samsung Electronics etc. for developing
standard platforms for mobile technology.
• Versions 1.0 and 1.1 were not released under specific code names, although Android 1.1 was
unofficially known as Petit Four. Android code names are confectionery-themed and have been in
alphabetical order since 2009's Android 1.5 Cupcake, with the most recent major version being
Android 8.1 Oreo, released in December 2017.
• The operating system has since gone through multiple major releases, with the current version being
9.0 "Pie", released in August 2018. The core Android source code is known as Android Open Source
Project (AOSP), and is primarily licensed under the Apache License.
1.2
Android Programming (BCA Science : VI) Introduction to Android
• On top of the Linux kernel, there are the middleware, libraries and APIs written in C/C++ and
application software running on an application framework which includes Java-compatible libraries.
Development of the Linux kernel continues independently of Android's other source code projects.
1.3
Android Programming (BCA Science : VI) Introduction to Android
Applications
Application Framework
Libraries
Android Rumtime
SQLite WebKft OpenGL ES
Core
Surface Libraries
FreeType Media
Manager Framework
Dalvik Virtual
Machine
SSL SGL libc
Linux Kernel
• An Android OS can be referred as a software stack of different layers, where every layer is a group of
several program components.
• The Android OS is roughly divided into five sections in four main layers:
Layer 1: Linux Kernel:
Kernel: Linux Kernel is the first layer, residing at the bottom of the architecture
and considered as to be the core layer. Linux Kernel is the kernel on which Android is based. This
layer contains all the low level device drivers for the various hardware components of an
Android device.
Layer 2: Libraries: This layer includes all the native libraries of Android. In this layer, native
2: Libraries:
libraries are developed/written in C/C++ languages to ensure smooth OS functionality when
accessing multiple apps at once. These libraries contain all the code that provides the main
features of an Android OS. For example, the SQLite library provides database support so that an
application can use it for data storage. The WebKit library provides functionalities for web
browsing.
nd
Android Runtime:
Runtime: At the same layer (2 Layer) as the libraries, the Android runtime provides a
set of core libraries that enable developers to write Android apps using the Java programming
language. This layer operates its own virtual environment. Dalvik Virtual Machine (DVM), for
developing Android Apps.
1.4
Android Programming (BCA Science : VI) Introduction to Android
Layer 3: Application Framework: Exposes the various capabilities of the Android OS to application
developers so that they can make use of them in their applications.
Layer 4: Applications:
Applications: At this top layer, you will find applications that ship with the Android
device (such as Phone, Contacts, Browser, etc.), as well as applications that you download and
install from the Android Market. Any applications that you write are located at this layer.
5. android.os
android.os:: Provides applications with access to standard operating system services including
messages, system services and inter-process communication.
6. android.text:
android.text: Used to render and manipulate text on a device display.
7. android.view:
android.view: The fundamental building blocks of application user interfaces.
8. android.widget
android.widget:: A rich collection of pre-built user interface components such as buttons, labels,
list views, layout managers, radio buttons etc.
9. android.webkit
android.webkit:: A set of classes intended to allow web-browsing capabilities to be built into
applications.
Libraries
Android Rumtime
SQLite WebKft OpenGL ES
Core
Surface Libraries
FreeType Media
Manager Framework
Dalvik Virtual
Machine
SSL SGL libc
1.6