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

Book description

If you know HTML, CSS, and JavaScript, you already have the tools you need to develop Android applications. Now updated for HTML5, the second edition of this hands-on guide shows you how to use open source web standards to design and build apps that can be adapted for any Android device.

You’ll learn how to create an Android-friendly web app on the platform of your choice, and then use Adobe’s free PhoneGap framework to convert it to a native Android app. Discover why device-agnostic mobile apps are the wave of the future, and start building apps that offer greater flexibility and a much broader reach.

  • Convert a website into a web application, complete with progress indicators and other features
  • Add animation with JQTouch to make your web app look and feel like a native Android app
  • Make use of client-side data storage with apps that run when the Android device is offline
  • Use PhoneGap to hook into advanced Android features, including the accelerometer, geolocation, and alerts
  • Test and debug your app on the Web with real users, and submit the finished product to the Android Market

Publisher resources

View/Submit Errata

Table of contents

  1. Building Android Apps with HTML, CSS, and JavaScript
    1. SPECIAL OFFER: Upgrade this ebook with O’Reilly
    2. Preface
      1. Who Should Read This Book
      2. What You Need to Use This Book
      3. Conventions Used in This Book
      4. Using Code Examples
      5. Safari® Books Online
      6. How to Contact Us
      7. Acknowledgments
    3. 1. Getting Started
      1. Web Apps Versus Native Apps
        1. What Is a Web App?
        2. What Is a Native App?
        3. Pros and Cons
        4. Which Approach Is Right for You?
      2. Web Programming Crash Course
        1. Introduction to HTML
        2. Introduction to CSS
          1. Applying a stylesheet
        3. Introduction to JavaScript
    4. 2. Basic Styling
      1. Don’t Have a Website?
      2. First Steps
        1. Prepare a Separate Android Stylesheet
        2. Control the Page Scaling
      3. Adding the Android CSS
      4. Adding the Android Look and Feel
      5. Adding Basic Behavior with jQuery
      6. What You’ve Learned
    5. 3. Advanced Styling
      1. Adding a Touch of Ajax
      2. Traffic Cop
        1. Setting Up Some Content to Work With
        2. Routing Requests with JavaScript
      3. Simple Bells and Whistles
        1. Progress Indicator
        2. Setting the Page Title
        3. Handling Long Titles
        4. Automatic Scroll-to-Top
        5. Hijacking Local Links Only
        6. Roll Your Own Back Button
      4. Adding an Icon to the Home Screen
      5. What You’ve Learned
    6. 4. Animation
      1. With a Little Help from Our Friend
      2. Sliding Home
      3. Adding the Dates Panel
      4. Adding the Date Panel
      5. Adding the New Entry Panel
      6. Adding the Settings Panel
      7. Putting It All Together
      8. Customizing jQTouch
      9. What You’ve Learned
    7. 5. Client-Side Data Storage
      1. Web Storage
        1. Saving User Settings to Local Storage
        2. Saving the Selected Date to Session Storage
      2. Web SQL Database
        1. Creating a Database
        2. Inserting Rows
          1. Error handling
        3. Selecting Rows and Handling Result Sets
        4. Deleting Rows
      3. Web Database Error Code Reference
      4. What You’ve Learned
    8. 6. Going Offline
      1. The Basics of the Offline Application Cache
      2. Online Whitelist and Fallback Options
      3. Creating a Dynamic Manifest File
      4. Debugging
        1. The JavaScript Console
      5. What You’ve Learned
    9. 7. Going Native
      1. Introduction to PhoneGap
      2. Building Your App Locally with Eclipse and the Android SDK
        1. Download and Install Eclipse Classic
        2. Download and Install the Android SDK
        3. Install the ADT Plug-In in Eclipse
        4. Add Android Platforms and Other Components
        5. Download the Latest Copy of PhoneGap
        6. Set Up a New Android Project
        7. Running Kilo as an Android App
      3. Controlling the Phone with JavaScript
        1. Beep, Vibrate, and Alert
        2. Geolocation
        3. Accelerometer
      4. What You’ve Learned
    10. 8. Submitting Your App to the Android Market
      1. Preparing a Release Version of Your App
        1. Removing Debug Code
        2. Versioning Your App
        3. Compile and Sign Your App
      2. Uploading Your App to the Android Market
      3. Distributing Your App Directly
      4. Further Reading
    11. A. Detecting Browsers with WURFL
      1. Installation
      2. Configuration
      3. Testing wurfl-php
    12. About the Authors
    13. Colophon
    14. SPECIAL OFFER: Upgrade this ebook with O’Reilly

Product information

  • Title: Building Android Apps with HTML, CSS, and JavaScript, 2nd Edition
  • Author(s): Jonathan Stark, Brian Jepson, Brian MacDonald
  • Release date: January 2012
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781449327934