Tip Calculator App Activity and the Activity Lifecycle

Class MainActivity (Figs. 3.103.16) is the Tip Calculator app’s Activity subclass. When you created the TipCalculator project, the IDE generated this class as a subclass of Activity and provided an override of class Activity’s inherited onCreate method (Fig. 3.11). Every Activity subclass must override this method. The default code for class MainActivity also included an onCreateOptionsMenu method, which we removed because it’s not used in this app. We’ll discuss onCreate shortly.

Get Android™ How to Program, Second Edition 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.