views:

395

answers:

1
@Override
protected void onResume(){
     //super.onResume();
        sensorManager.registerListener((SensorListener) listener,
                SensorManager.SENSOR_ACCELEROMETER
                |SensorManager.SENSOR_ORIENTATION,
                SensorManager.SENSOR_DELAY_NORMAL);
}

private SensorEventListener listener=new SensorEventListener() {
    public void onSensorChanged(SensorEvent event){
        if(event.sensor.getType() == Sensor.TYPE_ORIENTATION){
            System.out.println(event.values[0]);
        }
    }

    public void onAccuracyChanged(Sensor sensor, int accuracy){

    }
};

So the SensorManager.registerListener is where I'm having the issue. Eclipse insists on a SensorListener, and then proceeds to whine when I pass it one because SensorListener is depreciated. I can't seem to get this worked out and would really appreciate some input! I read the previous post and followed the instructions there to no avail. Thank you all very much!

Brad

A: 

As suggested on this post: android SensorEventListener problem take a look at the code here: Commonsware compass demo

I'm stuck on the same thing and it's helping me out

MattyW