title: Android - sensor or listener is null
body: <p>I am trying to implement a sensor listener in my app, and it throws a <code>sensor or listener is null</code> error at the <code>mSensorManager.registerListener(sensorEventListener, mSensor, mSensorManager.SENSOR_DELAY_FASTEST);</code> line. Here is my full code:</p>
  
  <pre><code>    dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));*/
      mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
      mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_GAME_ROTATION_VECTOR);
      sensorEventListener = new SensorEventListener() {
          public void onSensorChanged(SensorEvent event) {
              double xAxis = event.values[0];
              TextView textView = (TextView) findViewById(R.id.rotation);
              textView.setText(String.valueOf(xAxis));
          }
  
          public void onAccuracyChanged(Sensor s, int i) {
  
          }
      };
  
      mSensorManager.registerListener(sensorEventListener, mSensor, mSensorManager.SENSOR_DELAY_FASTEST);
  </code></pre>
  
  <p>I checked and the sensor was actually <code>null</code>. What am I doing wrong? Thanks.</p>
  
  <p><strong>EDIT</strong> : The device is a 2nd Gen. Moto G.</p>