Forums » C++ Framework » Accelerometer Thread »
| Filipe Lemos | Accelerometer Thread | ||
|---|---|---|---|
|
Added by Filipe Lemos about 1 year ago
Hi, I was having an issue in a scene, on Android, with the function
onSensorChanged(x, y, z, event.timestamp);
To this:
final float fx = x;
final float fy = y;
final float fz = z;
final long ftimestamp = event.timestamp;
Cocos2dxActivity activity = ((Cocos2dxActivity)mContext);
Cocos2dxGLSurfaceView surfaceView = (Cocos2dxGLSurfaceView) activity.findViewById(R.id.game_gl_surfaceview);
surfaceView.queueEvent(new Runnable() {
@Override
public void run() {
onSensorChanged(fx, fy, fz, ftimestamp);
}
});
It seems to be working but I'm not sure this is a good solution. Did anyone came across this issue and is there a better way to solve it? |
||
| blue eur | RE: Accelerometer Thread | ||
|
EDIT: it's working fine on all android version I tested on. Thanks a lot. |
(1-1/1)