title: How to Write consecutive Characteristic fast and stable for BLE in Android?
body: <p>I am developing BLE in Android , I can scan, connected and write characteristic to to the BLE device. </p>
  
  <p>I call the following function to pass <code>BluetoothGatt</code> and <code>characteristic</code> to <code>AsyncTask</code> when click the <code>Button</code>.</p>
  
  <pre><code>write_btn.setOnClickListener(new View.OnClickListener() {
       @Override
       public void onClick(View v) {
          new WriteCharacteristic(mBluetoothGatt , HueCharacteristic).execute();
       }
  });
  </code></pre>
  
  <p>The code of write characteristic is like the following:</p>
  
  <pre><code>private class WriteCharacteristic extends AsyncTask&lt;String, Void, String&gt; {
  
          public BluetoothGatt mGatt;
          public BluetoothGattCharacteristic mCharacteristic;
  
          public WriteCharacteristic(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic){
              mGatt = gatt;
              mCharacteristic = characteristic;
          }
  
          @Override
          protected String doInBackground(String... urls) {
              mGatt.writeCharacteristic(mCharacteristic);
              return null;
          }
      }
  </code></pre>
  
  <p>But I try to click the button consecutive, it seems the <strong>Android</strong> did not write every <code>characteristic</code> to the <strong>BLE device</strong>. </p>
  
  <p>If I click the button consecutive for 5 times , it will loss 1~3 times. It only write <code>characteristic</code> to <strong>BLE device</strong> for two times.   </p>
  
  <p><strong>Question:</strong></p>
  
  <p><strong><code>Is there any better way to write characteristic consecutive and stable to BLE device for Android?</code></strong></p>