I am using a ScheduledExecutorService to run a Runnable periodically. In the Runnable I have registered a SensorEventListener. I noticed that the SensorEventListener callbacks gets called on the main thread rather than a thread from the thread pool of the ScheduledExecutorService. I want to handle the callbacks for the sensor events off of the main thread. It looks like I am able to pass a Handler object when calling registerListener() of the SensorManager class and the callbacks will be run on the thread that the Handler is from.
Is there a way to get a reference to a Handler of a ScheduledExecutorService?