Building Android Apps with HTML, CSS, and JavaScript

Jonathan Stark


If you know HTML, CSS, and JavaScript, you already have the tools you need to develop Android applications. This hands-on book shows you how to use these open source web standards to design and build apps that can be adapted for any Android device -- without having to use Java. Buy the print book or ebook or purchase it in iBooks.


You are reading the text of an O'Reilly book that was published to this site as it was being written, to get feedback from you. This book uses the Open Feedback Publishing System (OFPS), an O'Reilly experiment that tries to bridge the gap between private manuscripts and public blogs.

Next to every paragraph, there is a link you can use to comment on what you're reading. We are grateful for any feedback you have: questions, comments, suggestions, and corrections are all welcome and appreciated.

Learn more and order at the book's catalog page.

Who Should Read This Book
What You Need to Use This Book
Conventions Used in This Book
Using Code Examples
Safari® Books Online
How to Contact Us
1. Getting Started
Web App vs. Native App
What is a Web App?
What is a Native App?
Pros and Cons
Which Approach is Right for You?
Web Programming Crash Course
Introduction to HTML
Intro to CSS
Intro to JavaScript
2. Basic Styling
Don’t have a website?
First Steps
Prepare a Separate Android Stylesheet
Control the Page Scaling
Adding the Android CSS
Adding the Android Look and Feel
Adding Basic Behavior with jQuery
What You’ve Learned
3. Advanced Styling
Adding a Touch of Ajax
Traffic Cop
Setting up Some Content to Work With
Routing Requests with JavaScript
Simple Bells and Whistles
Progress Indicator
Setting the Page Title
Handling Long Titles
Automatic Scroll-to-Top
Hijacking Local Links Only
Roll Your Own Back Button
Adding an Icon to the Home Screen
What You’ve Learned
4. Animation
With a Little Help from Our Friend
Sliding Home
Adding the Dates Panel
Adding the Date Panel
Adding the New Entry Panel
Adding the Settings Panel
Putting It All Together
Customizing jQTouch
What You’ve Learned
5. Client-Side Data Storage
Web Storage
Saving User Settings to Local Storage
Saving the Selected Date to Session Storage
Web SQL Database
Creating a Database
Inserting Rows
Selecting Rows and Handling Result Sets
Deleting Rows
What You’ve Learned
Web Database Error Code Reference
6. Going Offline
The Basics of the Offline Application Cache
Online Whitelist and Fallback Options
Creating a Dynamic Manifest File
The JavaScript Console
What You’ve Learned
7. Going Native
Intro to PhoneGap
Download the Android SDK
Download PhoneGap
Setting Up the Environment
Create an Android Virtual Device (AVD)
Build KiloGap
Installing KiloGap in the Emulator
Using the Screen’s Full Height
Customizing the App Icon
Installing KiloGap on your Phone
Controlling the Phone with JavaScript
Beep, Vibrate, and Alert
Geo Location
What You’ve Learned
8. Submitting Your App To Android Market
Preparing a Release Version of Your App
Removing Debug Code
Versioning Your App
Signing Your App
Uploading Your App to the Android Market
Distributing Your App Directly
Further Reading
A. Detecting Browsers with WURFL
Testing wurfl-php
Site last updated on: November 17, 2010 at 11:11:58 AM PST