Using Multiple Lists Together (That Expand on Demand)

An alternative to using small lists as structures is to use multiple lists, with each list holding a piece of the data.

Let’s design one more data structure out of a list: a phone book contact entry. Our contacts app will be very simple. Each entry will contain a person’s name and phone number. We will need two lists for this (one to hold the names and one to hold the numbers), and they will work together to keep the information organized.

This example works much like the one in Figure 6.17, where we added a new item each time a button was clicked. In this case, when a button is clicked, we’re going to take two pieces of information, the name and number, from the user via two text boxes and ...

Get Learning MIT App Inventor: A Hands-On Guide to Building Your Own Android Apps 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.