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

Defining a Variable That Depends on Runtime Elements

Variables are great. Sometimes you can initialize them and include the data as part of the initialization, such as with a hard-coded piece of text (see Figure 6.38). This kind of data is already known before the app starts because it’s right there in the code blocks.

Image

Figure 6.38 A perfectly fine global variable initialization that depends on known information.

However, sometimes you want to fill a variable from data that isn’t definitely known or that is somewhere else, such as in a TextBox. If you try to initialize a variable to include data from a component, it doesn’t work (see Figure ...

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