O'Reilly logo

Android Application Development For Dummies, 2nd Edition by Donn Felker, Michael Burton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Understanding Activities

An activity is a single, focused action that a user can take. For example, an activity might present a list of menu items that a user can choose from, or it might display photographs along with captions. An application may consist of only one activity or (like most applications in the Android system) several. Though activities may work together to appear to be one cohesive application, they work independently from each other.

remember.eps An activity in Android is an important part of an application’s overall life cycle, and the way the activities are launched and put together is a fundamental aspect of the Android application model. Every activity is implemented as an implementation of the Activity base class.

Almost all activities interact with the user, so the Activity class creates for you the window in which you can place your user interface (UI). Activities are most often presented in full-screen mode, but in some instances you can find an activity floating in a window or embedded inside another activity — known as an activity group.

Working with methods, stacks, and states

Two important methods that almost all activities implement are

check.png onCreate: Where the activity is initialized. Most importantly, it’s where you tell the activity which layout to use by using a layout ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required