Android Activities

Learn how Activities present content to the screen via Views and ViewGroups

When we hear “app,” we often think screen, text, buttons, colors—but that which we can see is only the proverbial tip of the iceberg. Android applications provide value through four top-level components: Receivers, Providers, Services, and Activities. Here, we’ll focus on the last one, Activity, the component that displays content to the user.

Along the way, we’ll discover Views and ViewGroups, the objects that represent visual content, how we use text-based layout files to compose these objects into designs, and how Activities convert these layout files into runtime[1] objects that draw themselves to the screen, a process called layout inflation.

Review:

  • Android applications provide value through four top-level component classes: BroadcastReceiver, ContentProvider, Service, and Activity.
  • Activity components are the only components that present interactive content to the user.
  • Views are atomic, indivisible elements that draw themselves to the screen.
  • ViewGroups arrange Views (and other ViewGroups) to form meaningful designs.
  • We compose designs in text files, known as layout files.
  • Activity objects read these files to convert them into programmable runtime objects.

[1]: Runtime refers to any application that is actively “running,” e.g. operating and visible on a device or emulator