O'Reilly logo

Learning MIT App Inventor: A Hands-On Guide to Building Your Own Android Apps by Mark Sherman, Derek Walter

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

An Example App: Random Guess

Pick a number from 1 to 10. Now have your opponent try to guess that number. Don’t give any hints; just say whether the guess is right or wrong. Imagine that your opponent is the computer, and it’s guessing at total random. That’s the app we’re going to build.

The interface is really simple, as in Figure 4.19. You can elaborate on the design, but for now, let’s just get to the good stuff: the local variable. Use a button to get the computer to make a guess. Two labels will tell the user what the latest computer guess was and whether it was correct.

Image

Figure 4.19 The Random Guess app in the Designer.

Figure 4.20 shows ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required