O'Reilly logo

Android™ How to Program, Second Edition by Abbey Deitel, Harvey Deitel, Paul Deitel

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

3.5. Adding Functionality to the App

Class MainActivity (Figs. 3.93.16) implements the Tip Calculator app’s functionality. It calculates the 15% and custom percentage tips and total bill amounts, and displays them in locale-specific currency format. To view the file, open src/com.deitel/tipcalculator and double clck MainActivity.java. You’ll need to enter most of the code in Figs. 3.93.16.

 1   // MainActivity.java 2   // Calculates bills using 15% and custom percentage tips. 3   package com.deitel.tipcalculator; 4  5   import java.text.NumberFormat; // for currency formatting 6  7   import android.app.Activity; // base class for activities 8   import android.os.Bundle; // for saving state information 9   import ...

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