Time for action - building the standard calculator

The first layout for the calculator will consist of a normal series of 0 to 9 buttons with a button for the various basic arithmetic operations add, subtract, multiply, and divide. It will also have buttons for equals and a button for the decimal point. While this would be a very easy screen to build in Java code, we'll build this example entirely as an XML resource. Since this application will have several different permutations of the same screen, using layout resource files with no Java code will make your life much easier.

  1. Start by creating a new project for the calculator:
    android create project -n Calculator -p Calculator -k com.packtpub.calculator -a CalculatorActivity -t 3
  2. Open the standard ...

Get Android User Interface Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.