Home Tutorials Hints & Tips

Getting Started in Android Development

Part 1 - The Activity Lifecycle


Welcome to the first of a series of tutorials focused on getting started in Android Development. In this series I will take you through the basic elements needed to get you started and self-sufficient at developing your own Android apps for phones and tablets. This series, in addition to the more advanced topics, can be found here. Each written tutorial is backed up by a short video that can be accessed through my website or my Youtube channel.

The Android Activity

An Android activity is a core function of any Android application. An activity is a piece of code that performs specific tasks associated with the app. An activity often has a layout associated with it and so can be related to specific screens of an app.

The diagram below shows a simple shopping lists app with three screens. You can see how you can produce a high level design for an app in this way. Each of the three boxes represents an Activity that perform a set function. There is a main activity that is loaded on start-up and this shows all shopping lists stored by the app. Clicking a list entry will take you to the actual shopping list itself. This is a second Activity. The third Activity allows new items to be added to a list.

Android Activities

The diagram below shows how the actual app may look. Here you can see that each of the Activities has a layout associated with it.

Android Activities

The Activity Lifecycle

It’s worth spending a little time looking at the Activity Lifecycle as we will come across these Activity states and methods right from your first project. Having an Activity lifecycle makes real sense. Activities must be created when they are first called and destroyed when they are finished with. But you may be playing a game that is an Activity and then a voice call comes into your phone. You will want to pause the current activity to take that call and then resume it when you end the call. Java methods are called when the Activity enters a state change. The onCreate(), onPause() and onResume() methods are the three most common methods associated with the Activity lifecycle that you will see.

The Android Activity Lifecycle

Privacy and Cookies Disclaimer Copyright
© 2015 - 2018 North Border Tech Training All rights reserved