Chapter 12

Dealing with a Bunch of Things at a Time

IN THIS CHAPTER

check Dealing with many objects at a time

check Creating versatile classes and methods

check Creating a drop-down list

All the world's a class,

And all the data, merely objects.

— JIMMY SHAKESPEARE, 11-YEAR-OLD COMPUTER GEEK

A class is a blueprint for things, and an object is a thing made from the blueprint. By thing, I mean a particular employee, a customer, an Android activity, or a more ethereal element, such as an SQLiteOpenHelper.

Android's SQLiteOpenHelper class assists developers in the creation of databases. An SQLiteOpenHelper doesn't look like anything in particular, certainly not like an employee or a bag of cheese. Nevertheless, SQLiteOpenHelper is a class.

This chapter covers another thing that you might not normally consider a class or an object — namely, a bunch of things. I use the word bunch, by the way, to avoid the formal terminology. (There's nothing wrong with the formal terminology, but I want to save it for this chapter's official grand opening, in the first section.)

Creating a Collection Class

A collection class is a class whose job is to store a bunch of objects at a time — a bunch of String objects, ...

Get Java Programming for Android Developers For Dummies, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.