Some pseudocode of what i'm doing,
public class MeasurementDevice implements SensorEventListener {
public MeasurementDevice() {
mSensorManager = (SensorManager) mApplicationContext.getSystemService(Context.SENSOR_SERVICE);
mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
mGyroscope = mSensorManager.getDefaultSensor(Sensor.TYPE_GYROSCOPE);
HandlerThread mHandlerThread = new HandlerThread("sensorThread");
mHandlerThread.start();
Handler handler = new Handler(mHandlerThread.getLooper());
mSensorManager.registerListener(this, mAccelerometer, samplingPeriodHint, handler);
mSensorManager.registerListener(this, mGyroscope, samplingPeriodHint, handler);
}
@Override
public void onSensorChanged(SensorEvent event) {
throw new RuntimeException();
}
}
But when the exception is thrown, i'm not really sure how I can catch it? Any ideas?