Code example for DefaultHttpClient

Methods: getParams

     * Sets the User-Agent header to be sent with each request. By default, 
     * "Android Asynchronous Http Client/VERSION (" is used. 
     * @param userAgent the string to use in the User-Agent header. 
    public void setUserAgent(String userAgent) {
        HttpProtocolParams.setUserAgent(this.httpClient.getParams(), userAgent);
     * Sets the connection time oout. By default, 10 seconds 
     * @param timeout the connect/socket timeout in milliseconds 
    public void setTimeout(int timeout){
        final HttpParams httpParams = this.httpClient.getParams();
        ConnManagerParams.setTimeout(httpParams, timeout);
        HttpConnectionParams.setSoTimeout(httpParams, timeout);
        HttpConnectionParams.setConnectionTimeout(httpParams, timeout);