Chapter 2. Activities and Intents

WHAT YOU WILL LEARN IN THIS CHAPTER

  • What activities are

  • How to apply styles and themes to activities

  • How to display activities as dialog windows

  • Understanding the concept of intents

  • How to use the Intent object to link activities

  • How intent filters help you to selectively connect to other activities

  • How to display alerts to the user using notifications

In Chapter 1, you learned that an activity is a window that contains the user interface of your applications. An application can have zero or more activities. Typically, applications have one or more activities, and the main aim of an activity is to interact with the user. From the moment an activity appears on the screen to the moment it is hidden, it goes through a number of stages, known as an activity's life cycle. Understanding the life cycle of an activity is vital to ensuring that your application works correctly. In this chapter, you will learn more about how activities work and the things that you need to take note of when designing your Android application.

Apart from activities, another unique concept in Android is that of an intent. An intent is basically the "glue" that enables different activities from different applications to work together seamlessly, ensuring that tasks can be performed as though they all belong to one single application. In the second part of this chapter, you will learn more about this very important concept and how you can use it to call built-in applications such as the ...

Get Beginning Android™ Application Development 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.