Your MyListener class is correct. The problem is in your call to registerListener(). That's an overloaded method. The one you're calling is the old one that still takes the deprecated class. Here's the new signature:
registerListener(SensorEventListener listener, Sensor sensor, int rate, Handler handler); On May 7, 11:00 am, doubleslash <[email protected]> wrote: > I recently installed SDK 1.5 and updated the Eclipse adt to 0.9. I > tried using the accelerometer sensor but kept getting an error when > registerring the listener. My code is as follows: > > class myActivity extends Activity{ > > SensorManager sm = (SensorManager)getSystemService > (Context.SENSOR_SERVICE); > sm.registerListener(new MyListener(), Sensor.TYPE_ACCELEROMETER, > SensorManager.SENSOR_DELAY_UI); > > class MyListener implements SensorEventListener{ > // implementation is irrelevant > > } > } > > I keep getting the error that I should change MyListener to type > SensorListener, which has been replaced by SensorEventListener in the > new SDK. > > I chose to compile my code against Android 1.5. It seems that I have > successfully set up the new SDK as it can find the new interface > SensorEventListener. Why does registerListener require an interface > that has been deprecated? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

