The new update for Android loopj Async Http lib is out and they changed a lot. Now you need to manually set Looper.prepare()
otherwise it uses synchronious mode ins
I had a similar issue and found that making HTTP requests with an AsyncHttpClient in a thread caused the problem.
I ran my HTTP request outside of the thread and it fixed the problem for me. You can try something like:
public class HttpRequest {
// A SyncHttpClient is an AsyncHttpClient
public static AsyncHttpClient syncHttpClient= new SyncHttpClient();
public static AsyncHttpClient asyncHttpClient = new AsyncHttpClient();
public static void setCookieStore(PersistentCookieStore cookieStore) {
getClient().setCookieStore(cookieStore);
}
public static void get(String url, RequestParams params, AsyncHttpResponseHandler responseHandler) {
getClient().get(url, params, responseHandler);
}
public static void post(String url, RequestParams params, AsyncHttpResponseHandler responseHandler) {
getClient().post(url, params, responseHandler);
}
/**
* @return an async client when calling from the main thread, otherwise a sync client.
*/
private static AsyncHttpClient getClient()
{
// Return the synchronous HTTP client when the thread is not prepared
if (Looper.myLooper() == null)
return syncHttpClient;
return asyncHttpClient;
}
}