Android Apps for Absolute Beginners

Book description

Anybody can start building simple apps for the Android platform, and this book will show you how. This book takes you through the process of getting your first Android applications up and running using plain English and practical examples. It cuts through the fog of jargon and mystery that surrounds Android application development, and gives you simple, step-by-step instructions to get you started.

This book:

  • Teaches Android application development in language anyone can understand, giving you the best possible start in Android development.

  • Provides simple, step-by-step examples that make learning easy, allowing you to pick up the concepts without fuss.

  • Offers clear code descriptions and layout so that you can get your apps running as soon as possible

What you'll learn

  • Get both yourself and your computer set up for Android app development.

  • How to use the Eclipse programming environment to make your Android development efficient and straightforward.

  • Follow steps in plain English to build simple apps and get them working immediately.

  • Style your application so that it looks good.

  • Make use of the Android's touch screen.

  • Use shortcuts and cheat sheets to create apps the easy way.

  • The basics of Java and XML to allow you to move onto ever-more advanced apps.

Who this book is for

If you have a great idea for an Android app, but have never programmed before, then this book is for you. You don't need to have any previous computer programming skills—as long as you have a desire to learn, and you know which end of the mouse is which, the world of Android app development awaits.

Table of contents

  1. Copyright
  2. About the Author
  3. About the Technical Reviewer
  4. Acknowledgments
  5. Introduction
    1. The Target: The Programming Neophyte
    2. The Weapon: Android, the Innovative Mobile Code Environment
    3. How This Book Is Organized
    4. The Formula for Success
    5. Required Software, Materials, and Equipment
      1. Operating System and IDE
      2. Software Development Kits
      3. Dual Monitors
  6. 1. Preliminary Information: Before We Get Started
    1. 1.1. Some History: What Is Android?
    2. 1.2. Advantage Android: How Can Android Benefit Me?
    3. 1.3. The Scope of This Book
      1. 1.3.1. What's Covered
      2. 1.3.2. What's Not Covered
    4. 1.4. Preparing for Liftoff: SDK Tools to Download
      1. 1.4.1. Java
      2. 1.4.2. Eclipse
      3. 1.4.3. Android SDK
    5. 1.5. Summary
  7. 2. What's Next? Our Road Ahead
    1. 2.1. Your Android Development IDE
    2. 2.2. Java, XML, and How Android Works
    3. 2.3. The Android Application Framework
    4. 2.4. Screen Layout Design
    5. 2.5. User Interface Design
    6. 2.6. Graphics and Animation Design
    7. 2.7. Interactivity
    8. 2.8. Content Providers
    9. 2.9. Intents and Intent Filters
    10. 2.10. The Future of Android
    11. 2.11. Summary
  8. 3. Setting Up Your Android Development Environment
    1. 3.1. Installing Java, Eclipse, and Android
      1. 3.1.1. Java SE and JRE: Your Foundation for Application Development
      2. 3.1.2. Eclipse IDE: The Development Environment
      3. 3.1.3. Android SDK: The Android Tool Kit for Eclipse
      4. 3.1.4. Android Development Tool: Android Tools for Eclipse
      5. 3.1.5. The Android Environment Within Eclipse
    2. 3.2. Updating the Android SDK
    3. 3.3. Setting Up AVDs and Smartphone Connections
      1. 3.3.1. AVDs: Smartphone Emulators
      2. 3.3.2. USB Smartphone Drivers: External Devices
    4. 3.4. Developing on 64-Bit Computing Platforms
    5. 3.5. Summary
  9. 4. Introducing the Android Software Development Platform
    1. 4.1. Understanding Java SE and the Dalvik Virtual Machine
    2. 4.2. The Directory Structure of an Android Project
      1. 4.2.1. Common Default Resources Folders
      2. 4.2.2. The Values Folder
    3. 4.3. Leveraging Android XML (Your Secret Weapon)
      1. 4.3.1. Screen Sizes
      2. 4.3.2. Desktop Clocks
    4. 4.4. Using Your Android Application Resources
      1. 4.4.1. Bitmap Images
      2. 4.4.2. Alternate Resource Folders
    5. 4.5. Launching Your Application: The AndroidManifest.xml File
    6. 4.6. Creating Your First Android Application
      1. 4.6.1. Launching Eclipse
      2. 4.6.2. Creating an Android Project
      3. 4.6.3. Inspecting and Editing the Application Files
      4. 4.6.4. Opening the MyHelloWorld Activity
      5. 4.6.5. Opening the UI Definition
      6. 4.6.6. Opening the Strings Resource File
      7. 4.6.7. Setting a Variable Value in strings.xml
      8. 4.6.8. Running the App
      9. 4.6.9. Adding an Application Icon
      10. 4.6.10. Adding Transparency
      11. 4.6.11. Creating the Icons
    7. 4.7. Summary
  10. 5. Android Framework Overview
    1. 5.1. The Foundation of OOP: The Object
      1. 5.1.1. Some OOP Terminology
      2. 5.1.2. The Blueprint for an Object: The Class
      3. 5.1.3. Providing Structure for Your Classes: Inheritance
      4. 5.1.4. Defining an Interface
      5. 5.1.5. Bundling Classes in a Logical Way: The Package
    2. 5.2. An Overview of XML
    3. 5.3. The Anatomy of an Android Application: The APK File
    4. 5.4. Android Application Components
      1. 5.4.1. Android Activities: Defining the UI
      2. 5.4.2. Android Services: Processing in the Background
      3. 5.4.3. Broadcast Receivers: Announcements and Notifications
      4. 5.4.4. Content Providers: Data Management
    5. 5.5. Android Intent Objects: Messaging for Components
    6. 5.6. Android Manifest XML: Declaring Your Components
    7. 5.7. Summary
  11. 6. Screen Layout Design: Views and Layouts
    1. 6.1. Android View Hierarchies
      1. 6.1.1. Using the View Class
      2. 6.1.2. Nesting Views: Using the ViewGroup Class
    2. 6.2. Defining Screen Layouts: Using XML
      1. 6.2.1. Setting Up for Your Screen Layout
      2. 6.2.2. Using Linear Layouts
        1. 6.2.2.1. Creating the LinearLayouts Project in Eclipse
        2. 6.2.2.2. Editing the main.xml File
        3. 6.2.2.3. Editing the strings.xml File
        4. 6.2.2.4. Updating main.xml File
        5. 6.2.2.5. Viewing LinearLayoutActivity.java
        6. 6.2.2.6. Running the LinearLayout App
      3. 6.2.3. Using Relative Layouts
      4. 6.2.4. Sliding Drawers: Expanding Your UI
      5. 6.2.5. Using Padding and Margins with Views and Layouts
      6. 6.2.6. Setting Paddingin Views
      7. 6.2.7. Setting Margins in ViewGroups
    3. 6.3. Summary
  12. 7. UI Design: Buttons, Menus, and Dialogs
    1. 7.1. Using Common UI Elements
      1. 7.1.1. Adding an Image Button to Your Layout
        1. 7.1.1.1. Defining Multistate Image Button Graphics in XML
        2. 7.1.1.2. Creating the UI Image Button Project in Eclipse
        3. 7.1.1.3. Creating the button1.xml File
        4. 7.1.1.4. Editing the main.xml File
        5. 7.1.1.5. Replacing the Default Background
      2. 7.1.2. Adding a Text to Your Layout
      3. 7.1.3. Adding an Image
    2. 7.2. Using Menus in Android
      1. 7.2.1. Creating the Menu Structure with XML
      2. 7.2.2. Defining Menu Item Strings
      3. 7.2.3. Inflating the Menu Structure via Java
      4. 7.2.4. Running the Application in the Android Emulator
      5. 7.2.5. Making the Menu Work
    3. 7.3. Adding Dialogs
      1. 7.3.1. Using Custom Dialog Subclasses
      2. 7.3.2. Displaying an Alert Dialog
    4. 7.4. Summary
  13. 8. An Introduction to Graphics Resources in Android
    1. 8.1. Introducing the Drawables
      1. 8.1.1. Implementing Images
      2. 8.1.2. Core Drawable Subclasses
    2. 8.2. Using Bitmap Images in Android
      1. 8.2.1. PNG Images
      2. 8.2.2. JPEG and GIF Images
    3. 8.3. Creating Animation in Android
      1. 8.3.1. Frame-based or Cel 2D Animation
        1. 8.3.1.1. Controlling Frame-based Animation via Java
        2. 8.3.1.2. Running the Frame-based Animation App in the Emulator
      2. 8.3.2. Tween Animation in Android
        1. 8.3.2.1. Creating the text_animation.xml File
        2. 8.3.2.2. Controlling Tween Animation via Java
    4. 8.4. Using Transitions
    5. 8.5. Creating 9-Patch Custom Scalable Images
    6. 8.6. Playing Video in Your Android Apps
      1. 8.6.1. Adding a VideoView Object
      2. 8.6.2. Adding the Java for Video
    7. 8.7. Summary
  14. 9. Adding Interactivity: Handling UI Events
    1. 9.1. An Overview of UI Events in Android
      1. 9.1.1. Listening for and Handling Events
      2. 9.1.2. Handling UI Events via the View Class
      3. 9.1.3. Event Callback Methods
    2. 9.2. Handling onClick Events
      1. 9.2.1. Implementing an onClick Listener for a UI Element
      2. 9.2.2. Adding an onClick Listener to an Activity in Android
        1. 9.2.2.1. Creating the Event Handling Examples Project in Eclipse
        2. 9.2.2.2. Editing the HandlerExamples.java File
        3. 9.2.2.3. Editing the main.xml File
        4. 9.2.2.4. Updating HandlerExamples.java
        5. 9.2.2.5. Running the Event Handling Examples App in the Emulator
    3. 9.3. Android Touchscreen Events: onTouch
    4. 9.4. Touchscreen's Right-Click Equivalent: onLongClick
    5. 9.5. Keyboard Event Listeners: onKeyUp and onKeyDown
      1. 9.5.1. Adding the XML for Keyboard Events
      2. 9.5.2. Adding the Java for Keyboard Events
    6. 9.6. Context Menus in Android: onCreateContextMenu
      1. 9.6.1. Adding the XML for Context Menus
      2. 9.6.2. Adding the Java for Context Menus
    7. 9.7. Controlling the Focus in Android
      1. 9.7.1. Adding the XML for Focus Control
      2. 9.7.2. Adding the Java for Focus Control
      3. 9.7.3. Setting Focus Availability
    8. 9.8. Summary
  15. 10. Understanding Content Providers
    1. 10.1. An Overview of Android Content Providers
      1. 10.1.1. Databases and Database Management Systems
      2. 10.1.2. Android Built-in Content Providers
        1. 10.1.2.1. Contacts Database Contact Providers
        2. 10.1.2.2. Android MediaStore Content Providers
    2. 10.2. Defining a Content Provider
      1. 10.2.1. Creating the Content Providers Example Project in Eclipse
      2. 10.2.2. Defining Security Permissions
      3. 10.2.3. Adding Data to the Contacts Database
    3. 10.3. Working with a Database
      1. 10.3.1. Querying a Content Provider: Accessing the Content
      2. 10.3.2. Appending to a Content Provider: Adding New Content
      3. 10.3.3. Modifying Content Provider Data: Updating the Content
      4. 10.3.4. Removing Content Provider Data: Deleting Content
    4. 10.4. Summary
  16. 11. Understanding Intents and Intent Filters
    1. 11.1. What Is an Intent?
    2. 11.2. Android Intent Messaging via Intent Objects
    3. 11.3. Intent Resolution: Implicit Intents & Explicit Intents
      1. 11.3.1. Explicit Intents
      2. 11.3.2. Implicit Intents
    4. 11.4. Using Intents with Activities
      1. 11.4.1. Writing the Digital Clock Activity
      2. 11.4.2. Wiring up the Application
      3. 11.4.3. Sending Intents
    5. 11.5. Android Services: Data Processing in its own Class
      1. 11.5.1. Using Intents with Services
      2. 11.5.2. Creating a Service
      3. 11.5.3. Implementing Our MediaPlayer Functions
      4. 11.5.4. Wiring the Buttons to the Service
      5. 11.5.5. Running the Application
    6. 11.6. Using Intents with Broadcast Receivers
      1. 11.6.1. Creating the Timer User Interface via XML
      2. 11.6.2. Creating a Timer Broadcast Receiver
      3. 11.6.3. Configuring the AndroidManifest.xml file <receiver> Tag
      4. 11.6.4. Implementing our Intent
      5. 11.6.5. Running the Timer Application via the Android 1.5 Emulator
    7. 11.7. Summary
  17. 12. The Future
    1. 12.1. Widgets: Creating Your Own Widgets in Android
    2. 12.2. Location-Based Services in Android
    3. 12.3. Google Maps in Android
    4. 12.4. Google Search in Android
    5. 12.5. Data Storage in Android
      1. 12.5.1. Shared Preferences
      2. 12.5.2. Internal Memory
      3. 12.5.3. External Memory
      4. 12.5.4. Using SQLite
    6. 12.6. Device Administration: Security for IT Deployments
    7. 12.7. Using the Android Camera Class to control a Camera
    8. 12.8. 3D Graphics: Using OpenGL ES 1.x in Android
    9. 12.9. FaceDetector
    10. 12.10. SoundPool
    11. 12.11. MediaRecorder
    12. 12.12. Summary

Product information

  • Title: Android Apps for Absolute Beginners
  • Author(s):
  • Release date: April 2011
  • Publisher(s): Apress
  • ISBN: 9781430234463