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

Lists that Expand on Demand

In most of this book, we’ve kept all our data either in properties of components or in global variables. These work great, but they have a limitation: They can’t expand. Sometimes we don’t know how much information we will need to store, and that’s another great use for lists.

The one-dimensional list we discussed earlier in this chapter is perfect for when we need our information to grow. With just one list, we can store any number of items in it.

Consider the contacts app we started imagining in the last section. The user might have 5 friends, or 50, or 500; our app should be able to handle all of them with no problem.

Clearly, we can’t make a global variable for each contact. We can’t guess how many friends the ...

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