public boolean send(byte[] bytes){
  if (!connected)   return false;
  try {
    outputStream.write(bytes);
    outputStream.flush();
    return true;
  }
 catch (  IOException e) {
    connected=false;
    Log.e(TAG,"Fail to send data");
    return false;
  }
 finally {
    if (!connected) {
      closeConnection();
    }
  }
}

public boolean send ( byte [ ] bytes ) { if ( ! connected ) return false ; try { outputStream . write ( bytes ) ; outputStream . flush ( ) ; return true ; } catch ( IOException e ) { connected = false ; Log . e ( TAG , "Fail to send data" ) ; return false ; } finally { if ( ! connected ) { closeConnection ( ) ; } } }
send array of bytes to bluetooth output stream .
