Android Applications Development
in Java
K.L.James
CONTENTS
Chapter 1: Introduction to Android
1.1 Android History and Evolution
1.2 Android Versions
1.3 Android Features
1.4 Android System Architecture
1.5 Dalvik Virtual Machine
1.6 Android Development Tools
1.7 Java JDK - Installation and Application Build
1.8 Downloading and Installing Android SDK
1.9 Android Emulator
1.10 Android Virtual Devices
1.11 Running Applications in Real Device
1.12 Exercise
Chapter 2: Essential Java for Android Applications
2.1 Objected Oriented Programming
2.2 Java Program Explained
2.3 Variables and Data Types
2.4 Objects, Classes and Methods
2.5 Encapsulation
2.6 Mathematical Operators
2.7 Relational Operators
2.8 Logical Operators
2.9 IF Statements
2.10 FOR, DO, WHILE Statements
2.11 SWITCH Statements
2.12 Using Packages
2.13 Inheritance
2.14 Overloading
2.15 Exception Handling
2.16 Using Streams
2.17 Exercise
Chapter 3: XML and JSON for Android
3.1 Document Object Model
3.2 XML Introduction
3.3 JSON Introduction
3.4 JSON, XML Advantages
3.5 XML Structure
3.6 JSON Elements and Arrays
3.7 Comparing JSON and XML
3.8 Parsing JSON and XML Documents
3.9 Exercise
Chapter 4: Starting Android Studio Project
4.1 Launching Android Studio
4.2 New Android Studio Project
4.3 Opening Existing Android Studio Project
4.4 Android Studio Main Screen Interface
4.5 Running Default Application
4.6 Exiting Android Studio
4.7 Creating Blank Layout
4.8 Building APK
4.9 Exercise
Chapter 5: Android Project Files and Application Components
5.1 Android Application Development Stages
5.2 Android Project Files
5.3 Android Application Components
5.4 Activity Component
5.5 Main Activity
5.6 Main Activity Layout File
5.7 Creating New Activity and Layout
5.8 Android Intents
5.9 Android Manifest File
5.10 Service Component
5.11 Creating New Service
5.12 Multimedia Service
5.13 Broadcast Receiver Component
5.14 Creating New Broadcast Receiver
5.15 Content Provider Component
5.16 Exercise
Chapter 6: User Interfaces Designing
6.1 Android Views and View Groups
6.2 Android User Interfaces
6.3 Creating User Interfaces
6.4 Creating TextView and Button Interfaces
6.5 Setting Interfaces Attributes
6.6 Sizing and Positioning Interfaces
6.7 Naming Interfaces
6.8 Text Attribute
6.9 Modifying Text Size
6.10 Setting Interface Background Colour
6.11 Cut, Copy, Delete, Dim Operations
6.12 Text Input Interfaces
6.13 Layouts
6.14 Exercise
Chapter 7: Start Writing Java Code
7.1 Application Coding Basics
7.2 Run Time Attributes Modification
7.3 Creating Methods
7.4 Reading User Input Data
7.5 Auto Complete Text View
7.6 Toast Alert
7.7 Setting Button Attributes
7.8 Button Events
7.9 Image Button
7.10 Radio Button
7.11 Radio Group
7.12 Check Box
7.13 Toggle Button
7.14 Switch
7.15 Exercise
Chapter 8: Using More Design Interfaces
8.1 Seek Bar
8.2 Progress Bar
8.3 Spinner
8.4 ListView
8.5 GridView
8.6 ImageView
8.7 ScrollView
8.8 Time Picker
8.9 Date Picker
8.10 Text to Speech
8.11 Exercise
Chapter 9: Databases in Android
9.1 Database Management Systems
9.2 SQL The Database Language
9.3 Database Creation
9.4 SQLite Database
9.5 Creating Databases and Tables
9.6 Creating Records and Inserting Data
9.7 Using Cursors for Retrieving Data
9.8 Using Arrays for Data Storage
9.9 Data Updating
9.10 Deleting Data
9.11 Creating SQLite application
9.12 Exercise
Chapter 10: Telephony and Messaging Applications
10.1 Telephony Applications
10.2 Sending and Receiving SMS
10.3 Wi-Fi Activity
10.4 Exercise
Chapter 11: XML and JSON Data Parsing, Google Services
11.1 XML Data Parsing
11.2 JSON Data Parsing
11.3 Google Play Service
11.4 Location Service
11.5 Google Maps
11.6 Exercise
Chapter 1
Introduction to Android
Android is the most widely used operating system for mobile devices such as smartphones and tablet computers. Apart from this, now Android operating system powers televisions, smart watches and several multimedia devices. The smartphone operating system acts as a complete operating system supporting a wide variety of hardware devices such as cameras, light sensor, GPS, accelerometer, and several others. This Chapter provides you an insight about Android operating system, its varieties and the evolution stages. After going through this chapter, you will also be able to understand the features of some Android powered devices and the major factors considered in their selection. Also, you will be able to download and install Java development kit and Android software development tools.
1.1 Android History and Evolution
Smartphones have evolved from being used as a mere communicating device to offering wide range of functions ranging from different online activities such as browsing the Web, e-commerce, utility bill payment, social networking activities to offline functions like video audio operations, calculator process, and so on. Before smartphones became common, people used to do online activities using computers. Later, with the miniaturization of electronic components and the use of advanced technology, mobile handsets transformed to miniature computers and people began to use these devices for online activities. Smartphones need suitable applications for doing any activity. Like in the case of computers, these applications work above the basic software for managing the activities of the associated device hardware components, which is known as the operating system .
The term operating system is now commonly used and is familiar to all. The term refers to the basic or fundamental set of computer instructions to make computers properly work. Operating system uses hardware resources efficiently to perform different tasks. Operating system is made up of two parts namely the kernel and the utility applications. The kernel is the lowest level program responsible for managing different resources such as process, memory, storage, and device by system calls and inter process communication. The process management creates and develops processes, allows data sharing between them through inter process communication and allows data sharing. The memory management divides the available memory into several small chunks. This also allocates and withdraws memory at different instances based on requirements. The mapping between the virtual address space and the physical address is also done by the memory management system. The storage management handles all storage related requirements like the creation and deletion of files, data compression, and data organization. Device management provides the ability for using different devices by the use of device drivers. Enabling data packets through the network and identifying the clients and servers in computer networks, enabling routing functionality are also done by the kernel. Hence, the operating system is considered as the basic set of instructions above which other applications work.