title: android SensorEventListener problem
body: <p>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 displayed a note</p>
  
  <blockquote>
    <p>The type SensorListener is deprecated</p>
  </blockquote>
  
  <p>I guess it is because the code from the book is written for the earlier SDK version so I tried to use SensorEventListener instead.</p>
  
  <p>Then when I tried to register the listener</p>
  
  <pre><code>sensorManager.registerListener(sensorListener, SensorManager.SENSOR_ORIENTATION, SensorManager.SENSOR_DELAY_FASTEST);
  </code></pre>
  
  <p>an error appeared:</p>
  
  <blockquote>
    <p>The method registerListener(SensorListener, int, int) in the type SensorManager is not applicable for the arguments (SensorEventListener, int, int)</p>
  </blockquote>
  
  <p>so I tried to cast SensorEventListener to SensorListener, but the application doesn't work.</p>
  
  <p>Does anyone know how to use sensor in newer SDK versions?</p>
  
  <p>Thank you.</p>