title: Communicating with Arduino Uno and Android nexus 5
body: <p>I'm new to android app. I want to read data from my arduino Uno R3 and display it on my app using a serial cable and an OTG adapter.</p>
  
  <p>Although, I can't get my UsbManager to recognized my device. So when I try to set up a connection, it always fail. 
  Here's the part of my code where I initiate everything.</p>
  
  <pre><code>public UsbManager = mUsbManager; 
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
      setContentView(R.layout.activity_display_depth);
      setupActionBar();   
      textView = (TextView) findViewById(R.id.textView2);
  
      mUsbManager = (UsbManager) getSystemService(Context.USB_SERVICE);
  
      button = (Button) findViewById(R.id.buttonStart);
      button.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            textView.setText("Bravo");
            updateDevice();
            if (mRunning == true)  {
               receiveThread();
            }
       }
      });
  }
  
  
  public void updateDevice() {
      Intent intent= getIntent();
      String action = intent.getAction();
      UsbDevice device = (UsbDevice) intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);
  
      if (device != null){
          Toast.makeText(this, "Initialisation 1", Toast.LENGTH_SHORT).show(); 
          initDevice(device);
      }
  
      if (UsbManager.ACTION_USB_DEVICE_ATTACHED.equals(action)) {
          Toast.makeText(this, "Initialisation", Toast.LENGTH_SHORT).show(); 
          initDevice(device);
      } else {
          initDevice(null);
      }
  
  
  }
  (...) //Obviously, this is not in my code!! 
  
   private boolean initDevice(UsbDevice device) {
  
          mConnection = mUsbManager.openDevice(device);
  
          if (mConnection == null) {
              if (DEBUG) Log.e(TAG, "Opening USB device failed!");
              Toast.makeText(DisplayDepth.this, "open failed", Toast.LENGTH_SHORT).show();
              return false;
          }
  </code></pre>
  
  <p>And it always fail here ( I get the toast msg "open failed" ). 
  I add to my manifest what it takes so my arduino r3 is recognized and a connection message is always shown when I plug it into my phone.... Need help!!! 
  Thanks </p>