4. Acquiring Data

While the prime directive of this chapter is to teach you how to acquire data from a remote source, this is really just a sneaky way for me to teach you about Android and the main thread. For the sake of simplicity, all the examples in this chapter will deal with downloading and rendering image data. In the next chapter, on adapters and lists, I’ll introduce you to parsing complex data and displaying it to users. Image data, as a general rule, is larger and more cumbersome, so you’ll run into more interesting and demonstrative timing issues in dealing with it.

The Main Thread

The Android operation system has exactly one blessed thread authorized to change anything that will be seen by the user. This alleviates what could be ...

Get Creating Android Applications: Develop and Design 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.