@Override
 public void onClick(View v) {
   switch (v.getId()) {
     case R.id.button_run:
       executeSample(
           getAsyncHttpClient(),
           (urlEditText == null || urlEditText.getText() == null)
               ? getDefaultURL()
               : urlEditText.getText().toString(),
           getRequestHeaders(),
           getRequestEntity(),
           getResponseHandler());
       break;
     case R.id.button_cancel:
       asyncHttpClient.cancelRequests(SampleParentActivity.this, true);
       break;
   }
 }
 /** Cancels the request if it is in progress, else does nothing. */
 public void cancel() {
   if (uploadRequest != null) {
     client.cancelRequests(uploadRequest.getContext(), true);
     NetworkClient.getInstance().onUploadFinished(uploadRequest.getRequestId(), false);
   }
 }
예제 #3
0
 public static void cancel(Context context) {
   client.cancelRequests(context, true);
 }