Code example for UnsupportedOperationException

0
    mSensor = mSensorMgr.getDefaultSensor(SensorManager.SENSOR_ACCELEROMETER);
     
    boolean supported = mSensorMgr.registerListener(this, mSensor, SensorManager.SENSOR_DELAY_GAME);
    if (!supported) {
      mSensorMgr.unregisterListener(this, mSensor);
      throw new UnsupportedOperationException("Accelerometer not supported");
    } 
  } 
 
  public void pause() { 
    if (mSensorMgr != null) {
    	mSensorMgr.unregisterListener(this, mSensor);
      mSensorMgr = null;
      mSensor = null;
    } 
  } 
 
  @Override 
	public void onAccuracyChanged(Sensor sensor, int accuracy) {
		 
Experience pair programming with AI  Get Codota for Java