开发者

Using sensor manager in android programming

开发者 https://www.devze.com 2023-03-25 06:17 出处:网络
I\'m new in android programming and now I have a problem. I want to use sensor manager in an old openGL program in netbeans IDE.

I'm new in android programming and now I have a problem. I want to use sensor manager in an old openGL program in netbeans IDE. but when i create a class that extends activity and implements sensorListener开发者_Python百科 , it doesn't work. Could u plz help me?

and another question: how can i simulate motion sensor in my computer?

Best Regards


how can i simulate motion sensor in my computer?

Check out this tool called Sensor Simulator


Make sure you have declared

public void onAccuracyChanged(Sensor sensor, int accuracy)

and

public void onSensorChanged(SensorEvent event)


You need to have the following methods :

SensorEventListener sel = new SensorEventListener() {
        @Override
        public void onSensorChanged(SensorEvent event) {
            //Your code here
        }

        @Override
        public void onAccuracyChanged(Sensor sensor, int accuracy) {
           //Your code here
        }
    };
0

精彩评论

暂无评论...
验证码 换一张
取 消