我正在尝试编写最简单的陀螺仪实现(只记录屏幕方向在变化时的情况)。有人能提供一个简单的示例吗?
这是我现在正在尝试的:
public class LessonFiveGLSurfaceView extends GLSurfaceView implements SensorEventListener
{
private LessonFiveRenderer mRenderer;
public LessonFiveGLSurfaceView(Context context)
{
super(context);
System.out.println("test");
}
@Override
public void onSensorChanged(SensorEvent event)
{
//output the Roll, Pitch and Yawn values
System.out.println("Orientation X (Roll) :"+ Float.toString(event.values[2]) +"\n"+
"Orientation Y (Pitch) :"+ Float.toString(event.values[1]) +"\n"+
"Orientation Z (Yaw) :"+ Float.toString(event.values[0]));
}
然而我遇到了错误:"类型LessonFiveGLSurfaceView必须实现继承的抽象方法SensorEventListener.onAccuracyChanged(Sensor, int)"。