9781648927997 Flipbook PDF


82 downloads 116 Views 17MB Size

Recommend Stories


Porque. PDF Created with deskpdf PDF Writer - Trial ::
Porque tu hogar empieza desde adentro. www.avilainteriores.com PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com Avila Interi

EMPRESAS HEADHUNTERS CHILE PDF
Get Instant Access to eBook Empresas Headhunters Chile PDF at Our Huge Library EMPRESAS HEADHUNTERS CHILE PDF ==> Download: EMPRESAS HEADHUNTERS CHIL

Story Transcript

MOBILE APPLICATION DEVELOPMENT - Practical Approach

Dr.K VENKATA NAGENDRA Mr.Y VENKATA RAMESH ISBN 9781648927997

I have great pleasure in authoring the book

Mobile Application

Development-Practical Approach for 7th Semester CSE students as per Jawaharlal Nehru Technological University, Anantapur, Syllabus.

Android

Programming by B.M Harwani, Pearson Education, 2013. The book is written in simple and elegant manner. The book contains five chapters based on four units of the syllabus. Chapter 1 deals with different versions of Android, Creating Android Virtual Devices, Creating the First Android Project Using the Text view Control and using the Android Emulator. Chapter 2 about understands the Role of Android Application Components, Understanding the Utility of Android API, Creating the User Interface, Commonly Used Layouts and Controls, Event Handling, Displaying Messages. Chapter 3 focuses on building Blocks for Android Application Design, Introduction to Layouts and utilizing resources and Scrolling Through Scroll View, playing Audio, Playing Video, Displaying Progress with Progress Bar. Chapter 4 deals with Using Selection widgets and Debugging, the Debugging Tool: Dalvik Debug Monitor Service(DDMS), Debugging Application, What Are Dialogs?, Selecting the Date and Time in One Application and Fragments. Chapter 5 illustrates Building Menus and Storing Data, Creating Interface Menus and Action Bars, Creating a Tabbed Action Bar and Creating a Drop-Down List Action Bar. Utmost care has been taken to avoid any printing errors. If found any can be brought to my notice so that it can be corrected in fourth coming editions. Suggestions and criticism for the improvement of the book is always most welcome. For any clarifications regarding the subject always can contact me through my mail id: [email protected] and [email protected].

Dr.K VENKATA NAGENDRA Mr.Y VENKATA RAMESH

At the outset I

The God almighty

showering his blessings

upon me in all walks of my life. Also I would like to thank my parents Mr.K.Gopala Krishna Murthy and Mrs.K.Jahnavi who encourage and support me in all my efforts. I extended my thanks to the Research Supervisor Dr.M.Ussenaiah, Assistant Professor, Department of Computer Science, Vikrama Simhapuri University, Nellore for his motivation, support and Guidence. My sincere thanks to the Chairman, Sri Dr.Vanki Penchalaiah, Audisankara Group of Institutions, Andhra Pradesh for his guidance and support. And also I would like to thanks the Director Prof. Dr. A.Mohan. I also express my gratitude to Prof. G.Suresh Kumar, Controller of Examinations, Audisankara College of Engineering & Technology, Gudur, for his support and help given to me in various occasions. I am grateful to my best friend Mr.Syed Riyaz Basha, Senior Software Engineer, Immco Software Solutions, Kerala and fellow members of the teaching staff at Audisankara College of Engineering & Technology. Last but not the least; I would like to thank my better-half Mrs. K.Haritha and my daughter KVN Mokshasri who cooperated and extended full support throughout for writing the book.

Dr.K VENKATA NAGENDRA

SYLLABUS MOBILE APPLICATION DEVELOPMENT -PRACTICAL APPROACH UNIT-1 Introduction to Android: The Android 4.1 jelly Bean SDK, Understanding the Android Software Stack, installing the Android SDK, Creating Android Virtual Devices, Creating the First Android Project, Using the Text view Control, Using the Android Emulator, The Android Debug Bridge(ADB).

UNIT 2 Basic Widgets: Understanding the Role of Android Application Components, Understanding the Utility of Android API, Overview of the Android Project Files, Understanding Activities, Role of the Android Manifest File, Creating the User Interface, Commonly Used Layouts and Controls, Event Handling, Displaying Messages Through Toast, Creating and Starting an Activity, Using the Edit Text Control, Choosing Options with Checkbox, Choosing Mutually Exclusive Items Using Radio Buttons.

UNIT 3 Building Blocks for Android Application Design: Introduction to Layouts, Linear Layout, Relative Layout, Absolute Layout, Using Image View, Frame Layout, Table Layout, Grid Layout, Adapting to Screen orientation. Utilizing Resources and Media Resources, Creating Values Resources, Using Drawable Resources, Switching States with Toggle Buttons, Creating an Images Switcher Application, Scrolling Through Scroll View, playing Audio, Playing Video, Displaying Progress with Progress Bar, Using Assets.

UNIT 4 Using Selection widgets and Debugging: Using List View, Using the Spinner control, Using the GridView Control, Creating an Image Gallery Using the View Pager Control, Using the Debugging Tool: Dalvik Debug Monitor Service(DDMS), Debugging Application, Using the Debug Perspective. Displaying And Fetching Information Using Dialogs and Fragments: What Are Dialogs?, Selecting the Date and Time in One Application, Fragments.

UNIT 5 Building Menus and Storing Data: Creating Interface Menus and Action Bars, Menus and Their Types, Creating Menus Through XML, Creating Menus Through Coding, Applying a Context Menu to a List View, Using the Action Bar, Replacing a Menu with the Action Bar, Creating a Tabbed Action Bar, Creating a Drop-Down List Action Bar. Using Databases: Using the SQLiteOpenHelperclasss, Accessing Databases with the ADB, Creating a Data Entry Form.

ABOUT THE AUTHOR

Dr. Kolluru Venkata Nagendra completed his Bachelor Degree in Computer Science from Sri Venkateswara University, Tirupathi. He completed his Master Degree in Computer Applications from Jawaharlal Nehru Technological University, Hyderabad. He completed his Master of Technology in Computer Science & Engineering from Acharya Nagarjuna University, Guntur. He completed his Ph.D in Computer Science from Vikrama Simhapuri University, Nellore, Andhra Pradesh. He has got more than a Decade of experience in various engineering colleges. Currently he is working as a Professor in the department of CSE at Audisankara College of Engineering & Technology (Autonomous), Gudur, Nellore (DT). His areas of interest include Big Data; Data ware housing and Data Mining and Cloud Computing.

Mr.Y Venkata Ramesh, working as Assistant Professor in the

Department of

Computer Science & Engineering at Geethanjali Institute of Science and Technology, Nellore, Andhra Pradesh, India. He is having 7+ years of teaching experience. He did his B.Tech and M.Tech in Computer Science & Engineering from Jawaharlal Nehru Technological University, Anantapur, Andhra Pradesh. His areas of interests are Networks, Mobile Application Development, Wireless Networks and Big data.

UNIT-1 INTRODUCTION TO ANDROID 1.1.The Android 4.1 jelly Bean SDK 1.2. Understanding the Android Software Stack 1.3.Installing the Android SDK 1.4.Creating Android Virtual Devices 1.5.Creating the First Android Project 1.6.Using the Text view Control 1.7.Using the Android Emulator 1.8.The Android Debug Bridge(ADB)

UNIT-2 BASIC WIDGETS 2.1. Understanding the Role of Android Application Components 2.2. Understanding the Utility of Android API 2.3. Overview of the Android Project Files 2.4. Understanding Activities 2.5. Role of the Android Manifest File 2.6. Creating the User Interface 2.7. Commonly Used Layouts and Controls 2.8. Event Handling 2.9. Displaying Messages through Toast 2.10. Creating and Starting an Activity 2.11. Using the Edit Text Control 2.12. Choosing Options with Checkbox 2.13. Choosing Mutually Exclusive Items Using Radio Buttons.

UNIT-3 BUILDING BLOCKS FOR ANDROID APPLICATION DESIGN 3.1. Introduction to Layouts 3.2. Linear Layout 3.3. Relative Layout 3.4. Absolute Layout 3.5. Using Image View 3.6. Frame Layout 3.7. Table Layout

1 - 28 02 03 04 13 14 22 27 27

28 - 58 29 30 31 32 34 36 37 37 41 43 46 49 52

59 - 123 59 59 65 70 73 74 76

3.8. Grid Layout 3.9. Adapting to Screen orientation UTILIZING RESOURCES AND MEDIA RESOURCES 3.1. Resources-Types 3.2. Creating Values Resources 3.3. Using Drawable Resources 3.4. Switching States with Toggle Buttons 3.5. Creating an Images Switcher Application 3.6. Scrolling Through Scroll View 3.7. Playing Audio 3.8. Playing Video 3.9. Displaying Progress with Progress Bar 3.10. Using assets

UNIT-4

79 82 88 88 101 103 106 108 110 116 118 122

124 - 165 USING SELECTION WIDGETS AND DEBUGGING

4.1. Using List View 124 4.2. Using the Spinner control 130 4.3. Using the GridView Control 135 4.4. Creating an Image Gallery Using the View Pager Control 140 4.5. Using the Debugging Tool: Dalvik Debug Monitor Service (DDMS) 142 4.6. Debugging Application 146 DISPLAYING AND FETCHING INFORMATION USING DIALOGS AND FRAGMENTS 4.1. Dialogs 148 4.2. Selecting the Date and Time in One Application 157 4.3. Fragments 161

UNIT-5 BUILDING MENUS AND STORING DATA 5.1. Creating Interface Menus and Action Bars 5.2. Menus and Their Types 5.3. Applying a Context Menu to a List View 5.4. Using the Action Bar 5.5. Replacing a Menu with the Action Bar 5.6. Creating a Tabbed Action Bar 5.7. Creating a Drop-Down List Action Bar USING DATABASES 5.1. Using the SQLiteOpenHelperclasss 5.2. Accessing Databases with the ADB 5.3. Creating a Data Entry Form

166 - 30 166 179 185 188 195 200 202 204 209 214

UNIT - I INTRODUCTION TO ANDROID ANDROID It enables developer to build real world mobile application using Android software development kit (SDK). Android can run on Android phone/tablet/devices of different screen sizes and resolutions. Android was initially developed by Android, Inc., a small Palo Alto, California company in October 2003. Google bought this company in July 2005 and released Android SDK in November 2007. Android Versions: Versions 1.0 and 1.1 were not released under specific code names. Android code names are confectionery (sweets and chocolates collectively) themed and have been in alphabetical order since Android versions should be listed below with version number, name, release date and API level. Code Name

Version Number

Release Date

Cup cake

1.5

April 27, 2009

3

Donut

1.6

Sept 15, 2009

4

Éclair

2.0 - 2.1

Oct 26, 2009

5-7

Froyo

2.2 - 2.2.3

May 20, 2010

8

Ginger bread

2.3 - 2.3.7

Dec 6, 2010

9 - 10

Honey comb

3.0 - 3.2.6

Feb 22, 2011

11 - 13

Ice cream Sandwich

4.0 - 4.0.4

Oct 18, 2011

14 - 15

Jelly bean

4.1 - 4.3.1

July 9, 2012

16 - 18

Kitkat

4.4 - 4.4.4

Oct 31, 2013

19 - 20

Lollipop

5.0 - 5.1.1

Nov 12, 2014

21 - 22

Marsh mallow

6.0 - 6.0.1

Oct 5, 2015

Nougat

7.0 - 7.1.2

Aug 22, 2016

24 - 25

Oreo

8.0 - 8.1

Aug 21, 2017

26 - 27

1

API Level

23

1.1.ANDROID 4.1 JELLY BEAN Android 4.1 jelly bean SDK was released with new features for developers in July 2012. Few of big features of this release include the following: Project Butter: It makes jelly bean UI faster and more responsive It increases CPU performance whenever screen is touched. Faster speech recognition: text. User can dictate to device without internet connection. Improved notification system: Notification can be expanded or collapsed through variety of gestures and user can block notifications is desired. Notification includes action buttons that enable to call directly from notification menu rather replying to email. Supports new languages: It includes support for several languages including Arabic, Hebrew, Hindi and Thai. It supports bidirectional text. Predictive keyboard: On basis of current context, next word of message is automatically predicted. Auto arranging home screen: Icons and widgets automatically resize and realign as per existing space. Helpful for visually impaired users: Gesture mode combined with voice helps visually impaired users to easily navigate user interface. Improved camera app: It includes new review mode of captured photos. User can swipe in from right of screen to quickly view captured photos. Better communication: Two devices can communicate with near field communication (NFC) that is devices can tap to share data. Android devices can pair to Bluetooth devices that support by just tapping them together. Improved Google Voice search: It equipped with question and answer search method that helps in solving users queries. Face lock: Unlocks device when user looks at it. It prevents screen from blacking out. Blink can used to conform that live person is unlocking device instead of photo. Google now: It displays cards to show desired information automatically. Examples: places card displays nearby restaurants and shops while moving. Google play widgets: Provides quick and easy access to movies, games, magazines and other media on device. It supports new purchases on Google play. Faster Google search: Google search can be opened quickly from lock screen and from system bar by swiping up and also tapping hardware search key if it is available on device. Supports antipiracy: This future supports developer in sense that applications are encrypted with device specific key making it difficult to copy and upload them to internet. 2

1.2. UNDERSTANDING ANDROID SOFTWARE STACK Android Operating System (software stack) is divided into five sections in four layers:

1. Linux kernel: This is kernel on which Android is based. This layer contains all low level device drivers for various hardware components of android device. 2. Libraries: These contain all code that provides main features of android OS. SQlite libraries provide database support. Web kit libraries provide functionalities for web browsing. Surface manager library provides 2D and 3D graphics. Free type library provides font support. Media framework provides recording and playback of audio and video formats. 3. Android runtime: At same layer as libraries, android runtime provides set of core libraries that enable developer to write android apps using java. Android runtime also includes Dalvik virtual machine, which enables every android Dalvik is specialized virtual machine designed for Android and optimized for battery powered mobile devices with limited memory and CPU. 4. Application framework: It exposes various capabilities of android OS to application developers. So that they can make use of them in their applications. It manages user interface and application resources. 5. Applications: At this top layer, you will find applications that ship with device (such as phone, contents, browser .....etc). You will find applications that you download and install from Android Market.

3

1.3.INSTALLING ANDROID SDK For developing native android application you need to install the following four applications: 1. Java Development Kit (JDK) It can download from http://oracle.com/technetwork/java/javasc/downloads/index.html. 2. Eclipse IDE It can download from http://eclipse.org/dowmloads/. 3. Android platform SDK starter package It can be downloading from http://developer.android.com/sdk/index.html. 4. Android Development Tools (ADT) plug in It can download from http://developer.android.com/sdk/eclipse-adt.html. The plug-in contains project templates and eclipse tools. Android SDK is not full development environment and includes only core SDK tools, you need to install platform tools and other components required for developing Android applications. Go to http://developer.comsdk/index.html and download package installer_r18_windows.exe. After downloading file, double click it. Android SDK manager window opens then select next button to move next screen. It checks presence of JDK on computer. If JDK is not found, download and Install JDK from http://www.oracle.com/technetwork/ java/javasc/downloads/index.html. Select JDK link that suits your platform and double click then you see setup wizard screen. Select next to see custom setup dialog box JDK installation.

Three categories of features (Development tools, source code an public JRE) are displayed and you select from dropdown list to choose features you want to install. Default location displayed is c:\program files\java\jdk1.8.0\,but you can use change button to select another location. Keep default settings and click next features are installed followed by dialog box with default folder to install JRE (Java Runtime Environment). Use change button to continue program in other location Select next button to continue. After java installation Android SDK tools setup wizard automatically resumes.

4

If java is already installed before beginning with Android SDK installation, wizard deletes its presence and displays version number of JDK on your machine.

Select next button, you get dialog box asking you to choose users, for which Android SDK is being installed. 1. Install for anyone using this computer. 2. Install just for me. Select install for anyone using this computer option and click next. Next dialog prompts you for location to install Android SDK Tools. Dialog box also displays default directory location for installing Android SDK tools as c:\Program Files\Android\android-sdk which can change by selecting Browse button. Select next button to continue.

5

appear as bellow.

folder, select do not create short cuts check box. Select install button to begin installation of Android SDK tools. After installation, select net button, next dialog box tells you android SDK tools setup wizard completed. Select finish to exit wizard. Note that check box start SDK manager (to download system images) is checked by default it means after finish clicked, Android SDK manager was launched.

6

Adding Platforms and Other Components: In this step you see how to use Android SDK manager to download and Install important SDK packages required for development environment.

Android SDK manager shows list of packages and their installation status. Dialog box shows Android SDK tools package is already installed on machine. Android SDK manager recommends platform by checking Android 4.1(API 16) and Google USB driver package by default. You can check more packages and uncheck existing packages to determine which API you want to install. Select all packages listed under Extras and click install button to initiate installation. Next dialog box shows list of packages that you have selected to install. You need to select accept option followed by install button to begin installation

7

Android SDK manger log window appears showing downloading and installation progress. It also shows list of Packages that have been loaded.

After select close button, next dialog box is android SDK manger Shown below.

Dialog box conform that android SDK platform tools, android4.1 (API16) and its components have been successfully installed. You do not need android SDK manager now, so you close it.

8

Get in touch

Social

© Copyright 2013 - 2024 MYDOKUMENT.COM - All rights reserved.