SensorEventListener in separate thread

后端 未结 5 948
广开言路
广开言路 2020-12-05 15:11

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

5条回答
  •  长情又很酷
    2020-12-05 15:57

    It looks like the SensorManager is actually responsible for calling the onSensorChanged method, and I don't think the fact that registerListener is called in this separate thread is going to make any difference. The easiest thing to do is probably to make onSensorChanged return instantly, by delegating all the heavy lifting to a separate thread. Or perhaps to an ASyncTask, which seems to be the official "right way" of doing such things.

提交回复
热议问题