Supporting hardware keyboards

The calculator we developed here is now a great on-screen Android calculator application, with both the simple and scientific functionality you'd expect. However, if a device has a hardware keyboard, the user will probably expect to be able to use it, which currently they can't. Further, if the device lacks a touchscreen, clicking on-screen buttons will quickly become frustrating. We need to implement hardware keyboard support for the application.

Implementing the hardware keyboard handling code is only useful to you if you've done the "Have a go Hero" sections and built a Calculator class to perform the required functions. In order to handle hardware keyboard events, you'll use the methods declared in the KeyEvent.Callback ...

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.