The Activity Class

The Activity class is designed to handle a single task that the user can perform. Activities almost always have a visible component that allows the user to interact with the activity to perform the task. The Activity class is not directly instantiated in an Android app. Rather, it is subclassed for every activity that the user needs to perform in the app. These subclasses are stored as .java files in the app project’s src folder. This allows developers to inherit all the functionality of the Activity class and add their own unique functionality through Java code. One of the most important inherited functions of the Activity class is the capability to respond to life cycle events such as onCreate and onPause (refer to Chapter ...

Get Learning Mobile App Development: A Hands-on Guide to Building Apps with iOS and Android 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.