title: How to cancel the request using OKHTTP
body: <p>I need to be able to <strong>MANAGER</strong>  some requests with <strong>OKHTTP</strong>, using the <code>Google Places AutoComplete</code> to receive some predictions by typing the Address. The <strong>Problem is</strong> Each time that I insert a <strong>CHAR</strong> it will make a new request but at the same time I need to cancel the previous one! Ex : New York City = 13 Requests at the same time! So I'm using a single instance of <code>Call</code> trying to cancel anything that has been requested but with no success. This is what I did!</p>
  
  <pre><code>Address.addTextChangedListener(new TextWatcher() {
          @Override
          public void beforeTextChanged(CharSequence s, int start, int count, int after) {
  
              if(Address.getText().toString().length() &gt; 3){
                  _Address = Address.getText().toString();
                  if(call != null){
                      call.cancel();
                  }
                  Request request = new Request.Builder()
                          .url(getPlaceAutoCompleteUrl(_Address))
                          .addHeader("content-type", "application/json")
                          .addHeader("User-Agent", "Mozilla/5.0 (Linux; U; Android 4.0.3; en-us; google_sdk Build/MR1) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30")
                          .build();
                  call = client.newCall(request);
  
  
                  call.enqueue(new Callback() {
                      public void onResponse(Call call, final Response response) throws IOException {
                          final String result = response.body().string();
                          runOnUiThread(new Runnable() {
                              @Override
                              public void run() {
                                  Log.d("Response",result);
                                  PlacePredictions place = null;
                                  try {
                                      place = LoganSquare.parse(result,PlacePredictions.class);
                                  } catch (IOException e) {
                                      e.printStackTrace();
                                  }
                                  if(autoCompleteAdapter == null){
                                      autoCompleteAdapter = new AutoCompleteAdapter(CustomPlaces.this);
                                      recyclerView.setAdapter(autoCompleteAdapter);
                                      autoCompleteAdapter.Add(place.getPlaces());
                                  }else {
                                      autoCompleteAdapter.Clear();
                                      autoCompleteAdapter.Add(place.getPlaces());
                                      autoCompleteAdapter.notifyDataSetChanged();
                                  }
                              }
                          });
                      }
                      public void onFailure(Call call, IOException e) {
                          //fail();
                      }
                  });
              }else {
                  if(autoCompleteAdapter != null){
                      autoCompleteAdapter.Clear();
                  }
              }
          }
  </code></pre>
  
  <p>I check if the <code>call</code> object is null and cancel the request but still keeps coming!</p>