title: Android Bluetooth input stream not reading full array
body: <p>I'm creating an app to read string values over Bluetooth serial port. My data receiving but in two parts. If I send $F00,A,B,0,M# via bluetooth it only reads <code>$</code> in first part and <code>F00,A,B,0,M#</code> in next part. I provided my code here. Please do correct me if I'm wrong.</p>
  
  <pre><code>InputStream inputStream=null;
      int avilableBytes=0;
      public ConnectedThread(BluetoothSocket socket){
          InputStream temp=null;
          try{
              temp=socket.getInputStream();
          }catch (IOException e){
              e.printStackTrace();
          }
          inputStream=temp;
      }
  
      public void run() {
          try{
              int bytes;
              while (true){
                  try{
                      avilableBytes=inputStream.available();
                      if (avilableBytes&gt;0){
                          byte[] buffer=new byte[avilableBytes];
                          bytes=inputStream.read(buffer);
                          final String readMessage=new String(buffer,0,bytes);
                          bt_handler.obtainMessage(handlerState,bytes,-1,readMessage).sendToTarget();
                          Log.d("PRAVEEN",readMessage);
                      }
                  }catch (IOException e){
                      e.printStackTrace();
                  }
              }
          }catch (Exception e){
              e.printStackTrace();
          }
      }
  </code></pre>