Using sensor manager in android programming
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
}
};
精彩评论