App Inventor

Book description

Yes, you can create your own apps for Android phones—and it's easy to do. This extraordinary book introduces App Inventor for Android, a powerful visual tool that lets anyone build apps for Android-based devices. Learn the basics of App Inventor with step-by-step instructions for more than a dozen fun projects, such as creating location-aware apps, data storage, and apps that include decision-making logic.

The second half of the book features an Inventor's manual to help you understand the fundamentals of app building and computer science. App Inventor makes an excellent textbook for beginners and experienced developers alike.

  • Design games and other apps with 2D graphics and animation
  • Create custom multi-media quizzes and study guides
  • Create a custom tour of your city, school, or workplace
  • Use an Android phone to control a LEGO® MINDSTORMS® NXT robot
  • Build location-aware apps by working with your phone’s sensors
  • Explore apps that incorporate information from the Web
  • Learn computer science as you build your apps

Publisher resources

View/Submit Errata

Table of contents

  1. Dedication
  2. A Note Regarding Supplemental Files
  3. Foreword
  4. Preface
    1. A Blocks Language for Mobile Phones
    2. What Can You Do with App Inventor?
    3. Why App Inventor Works
    4. What Kind of Apps Can You Build?
    5. Who Can Build Apps?
    6. Conventions Used in This Book
    7. How to Use This Book
    8. Acknowledgments
  5. 1. Hello Purr
    1. What You’ll Learn
    2. The App Inventor Environment
    3. Designing the Components
      1. Making a Label
      2. Adding the Button
      3. Adding the Meow Sound
    4. Adding Behaviors to the Components
      1. Making the Kitty Meow
      2. Adding a Purr
      3. Shaking the Phone
    5. Packaging the App for Downloading
    6. Sharing the App
    7. Variations
    8. Summary
  6. I. 12 Customizable Apps
    1. 2. PaintPot
      1. What You’ll Learn
      2. Getting Started
      3. Designing the Components
        1. Creating the Color Buttons
        2. Using Arrangements for Better Layouts
        3. Adding the Canvas
        4. Arranging the Bottom Buttons and the Camera Component
      4. Adding Behaviors to the Components
        1. Adding the Touch Event to Draw a Dot
        2. Adding the Drag Event That Draws a Line
        3. Adding Button Event Handlers
        4. Letting the User Take a Picture
        5. Changing the Dot Size
          1. Using variables
          2. Changing the values of variables
      5. The Complete App: PaintPot
      6. Variations
      7. Summary
    2. 3. MoleMash
      1. What You’ll Build
      2. What You’ll Learn
      3. Getting Started
        1. Designing the Components
          1. Placing the Action components
          2. Placing the Label components
      4. Adding Behaviors to the Components
        1. Moving the Mole
        2. Creating MoveMole
          1. Calling MoveMole when the app starts
          2. Calling MoveMole every second
        3. Keeping Score
        4. Resetting the Score
        5. Adding Behavior When the Mole Is Touched
      5. The Complete App: MoleMash
      6. Variations
      7. Summary
    3. 4. No Texting While Driving
      1. What You’ll Learn
      2. Getting Started
        1. Designing the Components
        2. Adding Behaviors to the Components
          1. Programming an autoresponse
          2. How the blocks work
        3. Entering a Custom Response
          1. How the blocks work
        4. Storing the Custom Response in a Database
          1. How the blocks work
        5. Retrieving the Custom Response When the App Opens
          1. How the blocks work
        6. Speaking the Incoming Texts Aloud
          1. How the blocks work
        7. Adding Location Information to the Response
          1. How the blocks work
        8. Sending the Location As Part of the Response
          1. How the blocks work
      3. The Complete App: No Texting While Driving
      4. Variations
      5. Summary
    4. 5. Ladybug Chase
      1. What You’ll Build
      2. What You’ll Learn
      3. Designing the Components
      4. Getting Started
      5. Animating the Ladybug
        1. Adding the Components
        2. Adding the Behavior
      6. Displaying the Energy Level
        1. Adding a Component
        2. Creating a Variable: Energy
        3. Drawing the Energy Bar
        4. Starvation
      7. Adding an Aphid
        1. Adding an ImageSprite
        2. Controlling the Aphid
          1. How the blocks work
        3. Having the Ladybug Eat the Aphid
          1. How the blocks work
        4. Detecting a Ladybug–Aphid Collision
          1. How the blocks work
        5. The Return of the Aphid
          1. How the blocks work
      8. Adding a Restart Button
      9. Adding the Frog
        1. Having the Frog Chase the Ladybug
          1. How the blocks work
        2. Having the Frog Eat the Ladybug
          1. How the blocks work
        3. The Return of the Ladybug
          1. How the blocks work
      10. Adding Sound Effects
      11. Variations
      12. Summary
    5. 6. Paris Map Tour
      1. What You’ll Learn
      2. Designing the Components
      3. Setting the Properties of ActivityStarter
      4. Adding Behaviors to the Components
        1. Creating a List of Destinations
        2. Letting the User Choose a Destination
          1. How the blocks work
        3. Opening Maps with a Search
          1. How the blocks work
      5. Setting Up a Virtual Tour
        1. Finding the DataUri for Specific Maps
        2. Defining the dataURIs List
        3. Modifying the ListPicker.AfterPicking Behavior
          1. How the blocks work
      6. Variations
      7. Summary
    6. 7. Android, Where’s My Car?
      1. What You’ll Learn
      2. Getting Started
      3. Designing the Components
      4. Adding Behaviors to the Components
        1. Displaying the Current Location
          1. How the blocks work
        2. Recording the Current Location
          1. How the blocks work
        3. Displaying Directions to the Remembered Location
          1. How the blocks work
        4. Storing the Remembered Location Persistently
          1. How the blocks work
        5. Retrieving the Remembered Location When the App Launches
          1. How the blocks work
      5. The Complete App: Android, Where’s My Car?
      6. Variations
      7. Summary
    7. 8. Presidents Quiz
      1. What You’ll Learn
      2. Getting Started
      3. Designing the Components
      4. Adding Behaviors to the Components
        1. Defining the Index Variable
        2. Displaying the First Question
          1. How the blocks work
        3. Iterating Through the Questions
          1. How the blocks work
      5. Making the Quiz Easy to Modify
        1. How the Blocks Work
      6. Switching the Image for Each Question
        1. How the Blocks Work
      7. Checking the User’s Answers
        1. How the Blocks Work
        2. How the Blocks Work
      8. The Complete App: The Presidents Quiz
      9. Variations
      10. Summary
    8. 9. Xylophone
      1. What You’ll Build
      2. What You’ll Learn
      3. Getting Started
      4. Designing the Components
      5. Creating the Keyboard
        1. Creating the First Note Buttons
        2. Adding the Sound Component
        3. Connecting the Sounds to the Buttons
        4. Telling Android to Load the Sounds
        5. Implementing the Remaining Notes
      6. Recording and Playing Back Notes
        1. Adding the Components
        2. Recording Notes and Times
          1. How the blocks work
        3. Playing Back Notes
          1. How the blocks work
        4. Playing Back Notes with Proper Delays
          1. How the blocks work
      7. Variations
      8. Summary
    9. 10. MakeQuiz and TakeQuiz
      1. What You’ll Learn
      2. Getting Started
      3. Designing the Components
      4. Adding Behaviors to the Components
        1. Recording the User’s Entries
          1. How the blocks work
        2. Blanking Out the Question and Answer
          1. How the blocks work
        3. Displaying Question-Answer Pairs on Multiple Lines
          1. How the blocks work
          2. Calling the new procedure
        4. Storing the Questions and Answers in a Database
          1. How the blocks work
        5. Loading Data from the Database
          1. How the blocks work
          2. How the blocks work
      5. The Complete App: MakeQuiz
      6. TakeQuiz: An App for Taking the Quiz in the Database
      7. TakeQuiz: Modifying the Blocks to Load the Quiz from the Database
        1. How the Blocks Work
      8. The Complete App: TakeQuiz
      9. Variations
      10. Summary
    10. 11. Broadcast Hub
      1. What You’ll Learn
      2. Getting Started
      3. Designing the Components
      4. Adding Behaviors to the Components
        1. How the Blocks Work
        2. Adding Someone to the Broadcast List
          1. How the blocks work
        3. Broadcasting Messages
          1. How the blocks work
        4. Cleaning Up Your List Display
          1. How the blocks work
        5. Logging the Broadcasted Texts
          1. How the blocks work
        6. Storing the BroadcastList in a Database
          1. How the blocks work
        7. Loading the BroadcastList from a Database
          1. How the blocks work
      5. The Complete App: Broadcast Hub
      6. Variations
      7. Summary
    11. 12. NXT Remote Control
      1. What You’ll Learn
      2. Getting Started
      3. Designing the Components
        1. Non-Visible Components
        2. Visible Components
      4. Adding Behaviors to the Components
        1. Connecting to the NXT
        2. Displaying the List of Robots
          1. How the blocks work
        3. Making the Bluetooth Connection
          1. How the blocks work
        4. Disconnecting from the NXT
          1. How the blocks work
        5. Driving the NXT
          1. How the blocks work
        6. Using the Ultrasonic Sensor to Detect Obstacles
          1. How the blocks work
      5. Variations
      6. Summary
    12. 13. Amazon at the Bookstore
      1. What You’ll Learn
      2. What Is an API?
      3. Designing the Components
      4. Designing the Behavior
        1. Searching by Keyword
          1. How the blocks work
        2. Searching by ISBN
          1. How the blocks work
        3. Don’t Leave Your Users Hanging
          1. How the blocks work
        4. Scanning a Book
          1. How the blocks work
        5. Improving the Display
          1. How the blocks work
      5. Customizing the API
      6. Variations
      7. Summary
  7. II. Inventor’s Manual
    1. 14. Understanding an App’s Architecture
      1. Components
      2. Behavior
        1. An App As a Recipe
        2. An App As a Set of Event Handlers
        3. Event Types
          1. User-initiated events
          2. Initialization events
          3. Timer events
          4. Animation events
          5. External events
        4. Event Handlers Can Ask Questions
        5. Event Handlers Can Repeat Blocks
        6. Event Handlers Can Remember Things
        7. Event Handlers Can Talk to the Web
      3. Summary
    2. 15. Engineering and Debugging an App
      1. Software Engineering Principles
        1. Design for Real People with Real Problems
        2. Build a Quick Prototype and Show It to Your Prospective Users
        3. Incremental Development
        4. Design Before Coding
        5. Comment Your Code
        6. Divide, Layer, and Conquer
        7. Understand Your Language: Tracing with Pen and Paper
      2. Debugging an App
        1. Watching Variables
        2. Testing Individual Blocks
        3. Incremental Development with Do It
        4. Activating and Deactivating Blocks
      3. Summary
    3. 16. Programming Your App’s Memory
      1. Named Memory Slots
      2. Properties
      3. Defining Variables
      4. Setting and Getting a Variable
      5. Setting a Variable to an Expression
        1. Incrementing a Variable
        2. Building Complex Expressions
        3. Displaying Variables
      6. Summary
    4. 17. Creating Animated Apps
      1. Adding a Canvas Component to Your App
      2. The Canvas Coordinate System
      3. Animating Objects with Timer Events
        1. Creating Movement
        2. Speed
      4. High-Level Animation Functions
        1. EdgeReached
        2. CollidingWith and NoLongerCollidingWith
      5. Interactive Animation
      6. Specifying Sprite Animation Without a Clock Timer
      7. Summary
    5. 18. Programming Your App to Make Decisions: Conditional Blocks
      1. Testing Conditions with if and ifelse Blocks
      2. Programming an Either/Or Decision
      3. Programming Conditions Within Conditions
      4. Programming Complex Conditions
      5. Summary
    6. 19. Programming Lists of Data
      1. Creating a List Variable
      2. Selecting an Item in a List
      3. Using an Index to Traverse a List
        1. Example: Traversing a List of Paint Colors
      4. Creating Input Forms and Dynamic Lists
        1. Defining a Dynamic List
        2. Adding an Item
        3. Displaying a List
        4. Removing an Item from a List
      5. Lists of Lists
      6. Summary
    7. 20. Repeating Blocks: Iteration
      1. Controlling an App’s Execution: Branching and Looping
      2. Repeating Functions on a List Using foreach
        1. A Closer Look at Looping
        2. Writing Maintainable Code
      3. A Second foreach Example: Displaying a List
      4. Repeating Blocks with while
        1. Using while to Synchronously Process Two Lists
        2. Using while to Compute a Formula
      5. Summary
    8. 21. Defining Procedures: Reusing Blocks
      1. Eliminating Redundancy
      2. Defining a Procedure
      3. Calling a Procedure
      4. The Program Counter
      5. Adding Parameters to Your Procedure
      6. Returning Values from a Procedure
      7. Reusing Blocks Among Apps
      8. A Second Example: distanceBetweenPoints
      9. Summary
    9. 22. Working with Databases
      1. Storing Persistent Data in TinyDB
      2. Retrieving Data from TinyDB
      3. Storing and Sharing Data with TinyWebDB
      4. Storing Data with TinyWebDB
      5. Requesting and Processing Data with TinyWebDB
      6. GetValue-GotValue in Action
        1. A More Complex GetValue/GotValue Example
        2. Requesting Data with Various Tags
        3. Processing Multiple Tags in TinyWebDB.GotValue
      7. Setting Up a Web Database
      8. Summary
    10. 23. Reading and Responding to Sensors
      1. Creating Location-Aware Apps
        1. GPS
        2. Sensing Location with App Inventor
        3. Checking Boundaries
        4. Location Information Providers: GPS, WiFi, and Cell ID
      2. Using the Orientation Sensor
        1. Using the Roll Parameter
        2. Moving Any Direction with Heading and Magnitude
        3. Using the Phone As a Compass
      3. Using the Accelerometer
        1. Responding to the Device Shaking
        2. Using the AccelerometerSensor’s Readings
        3. Detecting Free Fall
        4. Detecting Acceleration Using Calibrated Values
      4. Summary
    11. 24. Communicating with Web APIs
      1. Talking to Web APIs That Generate Images
        1. Setting the Image.Picture Property to a Chart API
        2. Building a Chart API URL Dynamically
      2. Talking to Web Data APIs
        1. Exploring the Web Interface of an API
        2. Accessing the API Through TinyWebDB
      3. Creating Your Own App Inventor–Compliant APIs
        1. Customizing Template Code
        2. Wrapping the Yahoo! Finance API
      4. Summary
  8. Index
  9. About the Authors
  10. Colophon
  11. Copyright

Product information

  • Title: App Inventor
  • Author(s): David Wolber, Hal Abelson, Liz Looney, Ellen Spertus
  • Release date: May 2011
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781449397487