2015-04-22 115 views

回答

2

official doc,正確執行是:

AsyncHttpClient client = new AsyncHttpClient(); 
client.get("http://www.google.com", null, new AsyncHttpResponseHandler() { 

    @Override 
    public void onStart() { 
     // called before request is started 
    } 

    @Override 
    public void onSuccess(int statusCode, Header[] headers, byte[] response) { 
     // called when response HTTP status is "200 OK" 
    } 

    @Override 
    public void onFailure(int statusCode, Header[] headers, byte[] errorResponse, Throwable e) { 
     // called when response HTTP status is "4XX" (eg. 401, 403, 404) 
    } 

    @Override 
    public void onRetry(int retryNo) { 
     // called when request is retried 
    } 
}); 
相關問題