Chapter 10. Everything's a Class

In this chapter, we will indeed see that everything's a class. By the end of this chapter, the missing link between Java and our XML layouts will be fully revealed, leaving us with the power to add all kinds of widgets to our apps.

Here, you will learn about the following topics:

  • Android UI elements as classes
  • Garbage collection
  • Our UI on the heap
  • Special types of a class that includes inner and anonymous

So, what do I mean by everything's a class?

All Android UI elements are classes too

When our app is run and the setContentView method is called from onCreate, the layout is inflated from XML UI classes and loaded into memory as usable objects. They are stored in a part of the DVM memory called the heap.

Reintroducing references ...

Get Android Programming for Beginners 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.