title: Android - InputManager.InputDeviceListener NewApi exception
body: <p>I want to catch events from keys and motion events from joystick connected to my Android.</p>
  
  <p>I'm using <code>InputManager.InputDeviceListener</code> but the minimal API level supported is 14 and <code>InputManager.InputDeviceListener</code> requires API level 16.</p>
  
  <p>Do you know a solution supported by API level 14 ?</p>
  
  <p>Code that not compiling : </p>
  
  <pre><code>public class MyActivity extends Activity implements InputManager.InputDeviceListener {
  
      @Override
      public void onResume() {        
          inputManager.registerInputDeviceListener(this, null);
  
          // Query all input devices.
          // We do this so that we can see them in the log as they are enumerated.
          int[] ids = inputManager.getInputDeviceIds();
          for (int i = 0; i &lt; ids.length; i++) 
          {
              getInputDeviceState(ids[i]);
          }
      }
  
  
      @Override
      protected void onPause()
      {
          inputManager.unregisterInputDeviceListener(this);
      }
  
      public InputDeviceState getInputDeviceState(int deviceId) 
      {
          InputDeviceState state = inputDeviceStates.get(deviceId);
          if (state == null) 
          {
              final InputDevice device = inputManager.getInputDevice(deviceId);
              if (device == null) 
              {
                  return null;
              }
              state = new InputDeviceState(device);
              inputDeviceStates.put(deviceId, state);
  
          }
          return state;
      }
  
  }
  </code></pre>
  
  <p>Code is from Android samples.</p>