Chapter 16. Programming Your App’s Memory

Figure 16-0.
Programming Your Apps

Just as people need to remember things, so do apps. This chapter examines how you can program an app to remember information.

When someone tells you the phone number of a pizza place, your brain stores it in a memory slot. If someone calls out some numbers for you to add, you store the numbers and intermediate results in memory slots. In such cases, you are not fully conscious of how your brain stores information or recalls it.

An app has a memory, as well, but its inner workings are far less mysterious than those of your brain. In this chapter, you’ll learn how to set up an app’s memory, how to store information in it, and how to retrieve that information at a later time.

Named Memory Slots

An app’s memory consists of a set of named memory slots. Some of these memory slots are created when you drag a component into your app; these slots are called properties. You can also define named memory slots that are not associated with a particular component; these are called variables. Whereas properties are typically associated with what is visible in an app, variables can be thought of as the app’s hidden “scratch” memory.


The user of an app can see visible components such as buttons, textboxes, and labels. Internally, however, each component is completely defined by a set of properties. The values stored in the memory ...

Get App Inventor 2, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.