title: Why does the serial BT data I received get chopped out?
body: <p>The data i receive from a BT serial connection should be:</p>
  
  <pre><code>0
  1
  2
  3
  .
  .
  .
  27
  28
  29
  0
  1
  2
  3
  .
  .
  .
  etc
  </code></pre>
  
  <p>But what i actually get are some of the data are chopped out. Like this:</p>
  
  <pre><code>11
  12
  1
  3
  14
  15
  1
  6
  1
  7
  18
  19
  2
  0 
  </code></pre>
  
  <p><strong>In the BTSerialService.java</strong></p>
  
  <p>/**
       * This thread runs during a connection with a remote device.
       * It handles all incoming and outgoing transmissions.
       */</p>
  
  <pre><code>private class ConnectedThread extends Thread {
      private final BluetoothSocket mmSocket;
      private final InputStream mmInStream;
      private final OutputStream mmOutStream;
  
  
  public ConnectedThread(BluetoothSocket socket) {
      Log.d(TAG, "create ConnectedThread");
      mmSocket = socket;
      InputStream tmpIn = null;
      OutputStream tmpOut = null;
  
      // Get the BluetoothSocket input and output streams
      try {
          tmpIn = socket.getInputStream();
          tmpOut = socket.getOutputStream();
      } catch (IOException e) {
          Log.e(TAG, "temp sockets not created", e);
      }
  
      mmInStream = tmpIn;
      mmOutStream = tmpOut;
  }
  
  public void run() {
      Log.i(TAG, "BEGIN mConnectedThread");
      byte[] buffer = new byte[1024];
      //final byte[] buffer = new byte[1024];
      int bytes;
  
      // Keep listening to the InputStream while connected
      while (true) {
          try {
  
              // Read from the InputStream
              bytes = mmInStream.read(buffer);
  
              //Send the obtained bytes to the UI Activity
              mHandler.obtainMessage(FinalSetting.MESSAGE_READ, bytes, -1, buffer).sendToTarget();
  
              } catch (IOException e) {
              Log.e(TAG, "disconnected", e);
              connectionLost();
              break;
          }
      }
  }
  </code></pre>
  
  <p><strong>Then in the FinalSetting.java</strong>
  Case Message Read:</p>
  
  <pre><code>case MESSAGE_READ:
                  int i;
  
                  byte[] readBuf = (byte[]) msg.obj; 
  
  
               // construct a string from the valid bytes in the buffer
                  String readMessage = new String(readBuf, 0, msg.arg1);
                  Log.i(LOG_TAG, readMessage);
  
                  mTextView.setText(readMessage);
                  String [] numbers = readMessage.split("\n");
                  int [] intNumber = new int[numbers.length];
  
                  for (String number : numbers) {
                      if(number.trim().length()&gt;0){
  
                         try{
                             for (i=0;i&lt;numbers.length;i++){
                                  intNumber[i] = Integer.valueOf(number.trim());
                                  if (intNumber[i]&lt;0 || intNumber[i]&gt;95){
                                      //some action
                                  }
                              }
                         } catch (NumberFormatException e){
                          Log.i(LOG_TAG, "Unable to parse integer" + e);
                         }    
                      }
  
                  }
  
                  break;
  </code></pre>
  
  <p><strong>And what LogCat shows:</strong></p>
  
  <pre><code>    05-06 17:28:07.079: I/HBAS(15090): 10
  
  05-06 17:28:07.079: I/HBAS(15090): 11
  
  05-06 17:28:07.079: I/HBAS(15090): 12
  
  05-06 17:28:07.969: I/HBAS(15090): 1
  05-06 17:28:08.029: I/HBAS(15090): 3
  
  05-06 17:28:09.019: I/HBAS(15090): 14
  
  05-06 17:28:09.979: I/HBAS(15090): 1
  05-06 17:28:10.029: I/HBAS(15090): 5
  
  05-06 17:28:10.989: I/HBAS(15090): 16
  
  05-06 17:28:12.009: I/HBAS(15090): 17
  
  05-06 17:28:12.999: I/HBAS(15090): 18
  
  05-06 17:28:13.999: I/HBAS(15090): 19
  
  05-06 17:28:14.999: I/HBAS(15090): 20
  
  05-06 17:28:16.009: I/HBAS(15090): 21
  </code></pre>
  
  <p>So does anyone knows how to solve this???
  Thanks in advance..</p>