3.6 Adding the App’s Logic

Class MainActivity (Figs. 3.123.18) implements the Tip Calculator app’s logic. It calculates the tip and total bill amounts, then displays them in locale-specific currency format. To view the file, in the Project window, expand the app/Java/com.deitel.tipcalculator node and double click MainActivity.java. You’ll need to enter most of the code in Figs. 3.123.18.

Fig. 3.12 MainActivity’s package and import statements

Computer code with the first 15 of 115 lines

Fig. 3.18 Anonymous inner class that implements interface TextWatcher

3.6.1 package and import Statements

Figure 3.12 shows the package ...

Get Android How to Program, 3/e 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.