Android Tutorials - Herong's Tutorial Examples

https://www.herongyang.com/Android

Copyright © 2011-2023 Herong Yang. All rights reserved.

Android Tutorials This book is a collection of notes and sample codes written by the author while he was learning Android system. Topics include Installing of Android SDK on Windows, Creating and running Android emulators, Developing First Android Application - HelloAndroid, Creating Android Project with 'android' Command, Building, Installing and Running the Debug Binary Package, Inspecting Android Application Package (APK) Files, Using Android Debug Bridge (adb) Tool, Copying files from and to Android device, Understanding Android File Systems, Using Android Java class libraries, Using 'adb logcat' Command for Debugging. Updated in 2023 (Version v3.05) with ADB tutorials.

Table of Contents

About This Book

Installing JDK 1.8 on Windows System

Downloading and Installing JDK 1.8

Writing My First Java Program

Setting JAVA_HOME Environment Variable

Installation of Android SDK R24 and Emulator

Downloading and Installing Android SDK R24

Running Android SDK Manager R24

Installing Android Platform 4.0.3 and Libraries

Verifying Android Platform Installation

Creating Android Virtual Device (AVD)

Viewing Android Virtual Device (AVD) Details

Launching Android Emulator in AVD Manager

Android Emulator Starting Screens

Android Emulator Built-in Apps and Widgets

Android Emulator Built-in Web Browser

Android Emulator for 7 Inch Tablet

Android Emulator for Google Watch

Missing Emulator Engine Program for 'arm' CPUS

x86 Emulation Requires Hardware Acceleration

HAXM - Hardware Accelerated Execution Manager

Installing Apache Ant 1.9 on Windows System

Downloading and Installing Apache Ant 1.9

Preparations on Using Apache Ant Tool

First Apache Ant Build File Example

Developing First Android Application - HelloAndroid

Creating Android Project with "android" Command

Listing Target Android Platforms

"HelloAndroid" - First Android Project

"HelloAndroid.java" - First Android Java Code

"ant debug" Command and Build Error

Building the Debug Binary Package

Installing the Debug Binary Package

Running the Debug Binary Package

Android Application Package (APK) Files

What Is APK File Format?

Android PDF Viewer APK File Contents

Installing Android PDF Viewer APK File

Copy PDF File to Android Emulator's File System

Installing Adobe Reader APK File

Android Debug Bridge (adb) Tool

What Is Android Debug Bridge (adb)

Install "adb" as Part of SDK Platform Tools

USB Debugging Connection to Use "adb" Tool

Wireless Debugging Connection to Use "adb" Tool

Debugging Connection to Android Device Emulators

Commands and Options Supported by "adb"

"adb install" and "adb uninstall" Commands

"adb push" and "adb pull" Commands

"adb shell" - Remote Shell Interface

Android File Systems

File System Hierarchy and Common Directories

"df -H" - Display Mounted File Systems

"mount" - Display Mounted File Systems

"find -L . -name" - Search Files on Android System

AboutAndroid - Application to Retrieve System Information

java.lang.System Class - Accessing System Information

Creating Android Project for Simple Application

Build, Install and Run Android Application

System.getProperties() - Retrieving System Properties

android.widget.ScrollView Class - Scrolling Text View

System.getenv() Method - System Environment Variables

android.os.Environment Class - Environment Folders

android.content.Context - Application Context Information

android.app.Activity Class and Activity Lifecycle

Introduction of Activity Lifecycle

onCreate() and Other Callback Methods

ActivityLog - Application to Create Log File

Viewing Activity Log File with "cat" Command in "adb shell"

Implementing Activity Callback Methods

ActivityLog Test - Activity Terminated by User

ActivityLog Test - Activity Stopped and Restarted

ActivityLog Test - Activity Paused and Resumed

View Objects and Layout Resource Files

android.view.View Class - Base of User Interface Components

View, ViewGroup, Layout, and Widget

What Is Layout Resource File?

AndroidView v1.0 - Creating a Layout in Java Class

AndroidView v2.0 - Creating a Layout in Resource File

AndroidView v3.0 - Referencing Views in Resource Files

AndroidView v3.1 - Layouts with Vertical Orientation

AndroidView v3.2 - Layouts with Horizontal Orientation

AndroidView v4.0 - Inserting Views to Parent Layout

Using "adb logcat" Command for Debugging

"adb logcat" Command - Displaying System Logs

"adb logcat" Command Options and Log Buffers

"adb logcat -v" Command - Log Format Control

"adb logcat" Command Arguments - Output Filters

Using "adb logcat" Command to Track the Lifecycle of an Application

Java Exceptions in AndroidRuntime Error Log

Build Process and Package File Content

"android create project" Command Options

Android Project Folder Structure

Android Application Project Build Process

Project Build Process Done by "ant debug" Command

Detailed Output of "ant -verbose debug" Command

Output of "ant -verbose debug" - Android SDK R17

"aapt" - Android Asset Packaging Tool

"aapt package" Command - Resource Code Generation

"javac" - Java Compilation Command

"dx.bat --dex" Command - Converting .class Files into .dex File

"apkbuilder" Command - Packaging and Signing .apk File

"zipalign" Command - Aligning File Locations in .apk Package

"aapt dump" Command - Printing Contents of .apk Package

META-INF Files - Digests, Signature and Certificate

Building Your Own Web Browser

android.webkit.WebView - Web Browser Base Class

AndroidWeb - My Own Web Browser

WebViewClient Subclass - Content Rendering Callbacks

saveWebArchive() Method - Saving Web Archive Files

Web Archive File - XML File of Base64 Encoded Data

Android Command Line Shell

What Is the Bourne Shell?

Bourne Shell Command Line Examples

Unix/Linux Command Line Programs

Android Command Line Tools

"dalvikvm" Command to Run Java Application

Samsung Galaxy Tab 3 Mini Tablet

About My Samsung Galaxy Tab 3 Mini Tablet

Samsung Galaxy Storage Usage

Running Services - Background Processes

Connect tablet to Computer using Bluetooth

Connect tablet Storage to Computer via USB

Using Wi-Fi to Connect to Internet

Setting up Gmail Access on Android tablet

Downloading and Installing from "Play Store"

USB Debugging Applications on Samsung Tablet

Samsung USB Driver for Mobile Phones

Turning on USB Debugging on Samsung Galaxy Tab 3

Running "adb" on USB Debugging Interface

Installing Application to Tablet using "ant installd"

Installing Application to Tablet using "adb -d install"

Installing "AboutAndroid" to Samsung Tablet

Android Tablet - LG-V905R

About My LG-V905R Android Tablet

Tablet Memory Usage

Running Services - Background Processes

Connect tablet to Computer using Bluetooth

Connect tablet Storage to Computer via USB

Using Wi-Fi to Connect to Internet

Setting up Gmail Access on Android tablet

Downloading and Installing from "Play Store"

USB Debugging Applications on LG-V905R Tablet

Turning on USB Debugging on LG-V905R

Viewing LG-V905R Android USB Device in Control Panel

Running "adb" on LG-V905R USB Debugging Interface

Installing Application to Tablet using "ant installd" Command

Installing Application to Tablet using "adb -d install" Command

Installing "AboutAndroid" to LG-V905R Tablet

Android Phone - LG-P925g

About My LG-P925g Android Phone

Phone Memory and SD (Secure Digital) Card

Running Services - Background Processes

Running Applications - Background and Foreground Processes

Connect Phone to Computer using Bluetooth

Connect Phone SD Card to Computer via USB

Using Wi-Fi Function to Reduce Data Cost

Setting up Gmail Access on Android Phone

Downloading and Installing from "Play Store"

USB Debugging Applications on LG-P925g Phone

Installing LG USB Device Driver on Windows

Viewing LG Android USB Device in Control Panel

Turning on USB Debugging on LG-P925g

Viewing USB Debugging Devices in Control Panel

Running "adb" on LG-P925g USB Debugging Interface

Installing Application to Phone using "ant installd" Command

Installing Application to Phone using "adb -d install" Command

"adb -d install" Command Options

Installing "AboutAndroid" to LG-P925g Phone

Developing Applications with Android API Level 7

Archived Tutorials

Archived: Downloading and Installing JDK 1.7

Archived: Downloading and Installing Android SDK R17

Archived: Running Android SDK Manager

Archived: Installing Android Platform 4.0.3 and Libraries

Archived: Verifying Android Platform Installation

Archived: Creating Android Virtual Device (AVD)

Archived: Launching Android Emulator in AVD Manager

Archived: Android Emulator Built-in Applications

Archived: Android Emulator Built-in Web Browser

Archived: Downloading and Installing Apache Ant 1.8

Archived: "HelloAndroid" - First Android Project

Archived: Building the Debug Binary Package

Archived: Installing the Debug Binary Package

Archived: Running the Debug Binary Package

Archived: Rebuild the Debug Binary Package

Archived: Redefine Text in Resource Files

Archived: Installing Android PDF Viewer APK File

Archived: Copy PDF File to Android Emulator's File System

Archived: Installing Adobe Reader APK File

Archived: "adb shell" - Remote Shell Interface

Archived: "adb push" and "adb pull" Commands

References

Full Version in PDF/EPUB

Keywords: Android, SDK, Application, Development