Chapter 2. Mastering the Life and Death of Android Apps

The previous chapter introduced us to the fundamentals of our programming tool, such as IDEs and virtual machines, and allowed us to create a Hello World app. This second chapter is fundamental because you will learn everything about Android activities and Android life cycles, which are mandatory to create Android apps. At the end of this chapter, we will have a solid understanding of how Android apps are born and their life and death. Moreover, mastering the concepts exposed by this chapter will result in better stability and avoid crashes and resource bloat, while a poor understanding can even introduce OS instability.

In this chapter, we will cover the following recipes:

  • Understanding Android activities
  • Practicing the activities' lifecycles
  • Going through the state saving management

Introduction

Android activities are the main building blocks of Android applications. The official Android activity definition, coming from the official documentation (http://developer.android.com) states the following:

An activity is a single, focused thing that the user can do. Almost all activities interact with the user[…].

In this chapter, we will focus on understanding them in order to master their lifecycle.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.118.99