public static AndroidHttpClient newInstance(String userAgent){
  HttpParams params=new BasicHttpParams();
  HttpConnectionParams.setStaleCheckingEnabled(params,false);
  HttpConnectionParams.setConnectionTimeout(params,20 * 1000);
  HttpConnectionParams.setSoTimeout(params,20 * 1000);
  HttpConnectionParams.setSocketBufferSize(params,8192);
  HttpClientParams.setRedirecting(params,false);
  HttpProtocolParams.setUserAgent(params,userAgent);
  SchemeRegistry schemeRegistry=new SchemeRegistry();
  schemeRegistry.register(new Scheme("http",PlainSocketFactory.getSocketFactory(),80));
  schemeRegistry.register(new Scheme("https",SSLSocketFactory.getSocketFactory(),443));
  ClientConnectionManager manager=new ThreadSafeClientConnManager(params,schemeRegistry);
  return new AndroidHttpClient(manager,params);
}

public static AndroidHttpClient newInstance ( String userAgent ) { HttpParams params = new BasicHttpParams ( ) ; HttpConnectionParams . setStaleCheckingEnabled ( params , false ) ; HttpConnectionParams . setConnectionTimeout ( params , 20 * 1000 ) ; HttpConnectionParams . setSoTimeout ( params , 20 * 1000 ) ; HttpConnectionParams . setSocketBufferSize ( params , 8192 ) ; HttpClientParams . setRedirecting ( params , false ) ; HttpProtocolParams . setUserAgent ( params , userAgent ) ; SchemeRegistry schemeRegistry = new SchemeRegistry ( ) ; schemeRegistry . register ( new Scheme ( "http" , PlainSocketFactory . getSocketFactory ( ) , 80 ) ) ; schemeRegistry . register ( new Scheme ( "https" , SSLSocketFactory . getSocketFactory ( ) , 443 ) ) ; ClientConnectionManager manager = new ThreadSafeClientConnManager ( params , schemeRegistry ) ; return new AndroidHttpClient ( manager , params ) ; }
create a new httpclient with reasonable defaults ( which you can update ) .
