I am trying to create an application which reads data from digital compass. I tried to reuse the code from the book Professional Android Application Development but the IDE
There is a separate SensorEventListener class you need to use. See here.