views:

56

answers:

1

Hi guys,

I am trying to implement asynchronus http client for Android and I am haveing a trouble with type mismatch:

The method execute(HttpUriRequest) in the type HttpClient is not applicable for the arguments (HttpRequest)    

I am doing all based on this tutorial: http://blog.androgames.net/12/retrieving-data-asynchronously/

Have found a type in AsynchronousSender - private HttpRequest request; but I have still problem with above which occurs in:

public void run() {
    try {
        final HttpResponse response;
        synchronized (httpClient) {
            response = getClient().execute(request); //<-- here is that problem
        }
        // process response
        wrapper.setResponse(response);
        handler.post(wrapper);
    } catch (ClientProtocolException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
}

Can you suggest anything ?

cheers, /Marcin

+1  A: 

The code snippets on http://blog.androgames.net/12/retrieving-data-asynchronously/ are wrong. To fix it just replace HttpRequest with HttpUriRequest since the method signature is: HttpClient#execute(HttpUriRequest). It shouldn't be any problem since most requests you work with are HttpUriRequest instances.

fornwall
Not working that way as protected AsynchronousSender(HttpRequest request... method is expecting request to be HttpRequest type
Marcin
@Marcin: Yes, but AsynchronousSender snippet is _incorrect_ - you should update it and replace HttpRequest with HttpUriRequest.
fornwall