Activities, Fragments, and Intents
J. F. DiMarzio · 2016
An Android application can have zero or more activities. Typically, applications have one or more activities. The main purpose 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. These stages are known as an activity's life cycle. In addition to activities, Android N also supports fragments, a feature that was introduced for tablets in Android 3.0 and for phones in Android 4.0. This chapter shows how activities and fragments work together. An intent is basically the “glue” that enables activities from different applications to work together seamlessly, ensuring that tasks can be performed as though they all belong to one single application. The chapter explains how to use intents to call built-in applications such as the Browser, Phone, Maps, and more.