loopj/android-async-http — Issue #40: cancelRequests not working!!! 
Author: aoyama
Created: 2012-02-24 05:39:47+00:00
State: open

Executed the cancelRequests Method! But onSuccess be called. Why?

my code
==============================================================
import android.app.Activity;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.loopj.android.http.*;

public class HttpClientActivity extends Activity {

private TextView textView = null;
private Button btn = null;
ProgressDialog progressDialog = null;
AsyncHttpClient client = null;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.httpclient_app);
textView = (TextView)findViewById(R.id.textView1);
btn = (Button)findViewById(R.id.button1);

btn.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {

client = new AsyncHttpClient();
client.get("http://www.yahoo.co.jp", new AsyncHttpResponseHandler() {

@Override
public void onStart() {
client.cancelRequests(HttpClientActivity.this, true);
}

@Override
public void onSuccess(String response) {
// Why called the onSuccess method?
textView.setText(response);
System.out.println(response);
}

@Override
public void onFailure(Throwable throwable) {
System.out.println(throwable.toString());
}
});

}
});

}

}
==============================================================