title: MifareUltralight: sector select causes TagLostException
body: <p>I am trying to use SECTOR_SELECT to read and write to/from specified sectors, but get a <code>TagLostException</code> when I send the second part of the command through <code>MifareUltralight.transceive()</code>. How can I select and manipulate sectors?</p>
  
  <p>I am using an Android Nexus 6 (6.0.1) to send commands to and get data from an NXP NTAG (NT3H1201). I am able to use the GET_VERSION command (60h) with transceive (both through <code>NfcA</code> and <code>MifareUltralight</code>).</p>
  
  <p>The method I am using to select a sector:</p>
  
  <pre><code>public void selectSector(byte sector, MifareUltralight mifareUltralight) throws IOException {
      if (mifareUltralight.isConnected()) {
          mifareUltralight.close();
      }
  
      // SECTOR_SELECT command (see nxp p. 46)
      byte[] sectorSelectCmdPacket1 = new byte[2];
      byte[] sectorSelectCmdPacket2 = new byte[4];
  
      sectorSelectCmdPacket1[0] = (byte) 0xc2; // Sector select command
      sectorSelectCmdPacket1[1] = (byte) 0xff;
  
      sectorSelectCmdPacket2[0] = sector; // Memory sector to be selected; 1 for I2C 2k version
      sectorSelectCmdPacket2[1] = (byte) 0x00;
      sectorSelectCmdPacket2[2] = (byte) 0x00;
      sectorSelectCmdPacket2[3] = (byte) 0x00;
  
      mifareUltralight.connect();
  
      try {
          // ACK = 0A
          byte[] sectorSelectResp1 = mifareUltralight.transceive(sectorSelectCmdPacket1);
          Log.w(TAG, bytesToHex(sectorSelectResp1));
      } catch (IOException e) {
          Log.w(TAG, "selectSector: there was an exception while sending first sector select command");
          e.printStackTrace();
      }
  
      try {
          mifareUltralight.transceive(sectorSelectCmdPacket2);
          Log.w(TAG, "Second sector select command sent");
      } catch (IOException e) {
          Log.w(TAG, "selectSector: there was an exception while sending second sector select command");
          e.printStackTrace();
      }
  
      mifareUltralight.close();
  }
  </code></pre>
  
  <p>When I call the selectSector method, the first transceive completes but the second does not, resulting in the error</p>
  
  <blockquote>
    <p>android.nfc.TagLostException: Tag was lost.</p>
  </blockquote>
  
  <p>How can I select and manipulate sectors without getting the <code>TagLostException</code>?</p>