9781449316419
index.html

Building Android Apps with HTML, CSS, and JavaScript, 2nd Edition

Jonathan Stark

Brian Jepson

O’Reilly Production Services

David Futato

Robert Romano

Karen Montgomery

Printed in the United States of America.

[LSI]

O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://my.safaribooksonline.com). For more information, contact our corporate/institutional sales department: (800) 998-9938 or .

Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc. Building Android Apps with HTML, CSS, and JavaScript, the image of a maleo, and related trade dress are trademarks of O’Reilly Media, Inc.

Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a trademark claim, the designations have been printed in caps or initial caps.

While every precaution has been taken in the preparation of this book, the publisher and authors assume no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein.

Abstract

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.

Note

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.


Dedication

To Erica & Cooper

Preface
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
Acknowledgments
1. Getting Started
Web Apps Versus Native Apps
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
Introduction to CSS
Introduction 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
Web Database Error Code Reference
What You’ve Learned
6. Going Offline
The Basics of the Offline Application Cache
Online Whitelist and Fallback Options
Creating a Dynamic Manifest File
Debugging
The JavaScript Console
What You’ve Learned
7. Going Native
Introduction to PhoneGap
Building Your App Locally with Eclipse and the Android SDK
Download and Install Eclipse Classic
Download and Install the Android SDK
Install the ADT Plug-In in Eclipse
Add Android Platforms and Other Components
Download the Latest Copy of PhoneGap
Set Up a New Android Project
Running Kilo as an Android App
Controlling the Phone with JavaScript
Beep, Vibrate, and Alert
Geolocation
Accelerometer
What You’ve Learned
8. Submitting Your App to the Android Market
Preparing a Release Version of Your App
Removing Debug Code
Versioning Your App
Compile and Sign Your App
Uploading Your App to the Android Market
Distributing Your App Directly
Further Reading
A. Detecting Browsers with WURFL
Installation
Configuration
Testing wurfl-php
Site last updated on: February 4, 2012 at 06:56:15 PM PST