Code example for UnsupportedOperationException

0
      throw new UnsupportedOperationException("Sensors not supported");
    } 
    boolean supported = mSensorMgr.registerListener(this, SensorManager.SENSOR_ACCELEROMETER, SensorManager.SENSOR_DELAY_GAME);
    if (!supported) {
      mSensorMgr.unregisterListener(this, SensorManager.SENSOR_ACCELEROMETER);
      throw new UnsupportedOperationException("Accelerometer not supported");
    } 
  } 
 
  public void pause() { 
    if (mSensorMgr != null) {
      mSensorMgr.unregisterListener(this, SensorManager.SENSOR_ACCELEROMETER);
      mSensorMgr = null;
    } 
  } 
 
  public void onAccuracyChanged(int sensor, int accuracy) { }
 
  public void onSensorChanged(int sensor, float[] values) 
  { 
    if (sensor != SensorManager.SENSOR_ACCELEROMETER) return;