title: How to covert String to byte for BLE mBluetoothGatt.writeCharacteristic?
body: <p>I am developing in <code>Android BLE</code>.</p>
  
  <p>I try to send string to <code>BLE device(like TI CC2541)</code> , and it seems can not send string direct to <code>BLE device</code>.
  It need to convert the <strong>String to Byte</strong>.</p>
  
  <p>I have search some information , there has someone use <code>URLEncoder.encode</code>.
  But I am not sure which is the answer what I need.</p>
  
  <p>But how to convert the String to Byte?</p>
  
  <p>The following code is <code>writeCharacteristic</code> for <code>BLE</code></p>
  
  <pre><code>public void writeString(String text) {
          // TODO Auto-generated method stub
          BluetoothGattService HelloService = mBluetoothGatt.getService(HELLO_SERVICE_UUID);
  
          BluetoothGattCharacteristic StringCharacteristic = HelloService.getCharacteristic(UUID_HELLO_CHARACTERISTIC_WRITE_STRING);
  
          mBluetoothGatt.setCharacteristicNotification(StringCharacteristic , true);
  
              int A = Integer.parseInt(text);
  
              //How to convert the String to Byte here and set the Byte to setValue ?????
  
          StringCharacteristic .setValue(A, BluetoothGattCharacteristic.FORMAT_UINT8, 0);
          mBluetoothGatt.writeCharacteristic(StringCharacteristic );
  
          Log.d(TAG, "StepCount Characteristic End!");        
  
      }
  </code></pre>
  
  <p>How to convert the String to Byte?</p>