This seems like a basic question, but after searching for a while and playing with it, I\'ve come to the point where some help would be appreciated. I would like to have a
Get the handler of the thread and register the listener on that thread. For example:
public void run() {
Sensor sensor = this.sensorManager.getDefaultSensor(Sensor.TYPE_GRAVITY);
Looper.prepare();
Handler gHandler = new Handler();
this.sensorManager.registerListener(gravitySensorEventListener, sensor, SensorManager.SENSOR_DELAY_NORMAL, gHandler);
Looper.loop();
}
hopes this would help you.