Created
July 25, 2012 01:06
-
-
Save anonymous/3173748 to your computer and use it in GitHub Desktop.
Example of a thread safe HttpClient in Android.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static DefaultHttpClient getThreadSafeClient() { | |
DefaultHttpClient client = new DefaultHttpClient(); | |
ClientConnectionManager mgr = client.getConnectionManager(); | |
HttpParams params = client.getParams(); | |
client = new DefaultHttpClient( | |
new ThreadSafeClientConnManager(params, | |
mgr.getSchemeRegistry()), params); | |
return client; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment