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 solved the issue by passing parameter in AsyncHttpResponseHandler(Looper.getMainLooper()) like this.
First of all i used two classes one is MainActivity and Download Class. In MainActivity class, i call post method which is implement in the Downloadclass. Then Download class contains POST () which was import from my library like import com.loopj.android.http.*;
MainActivity.Class
clientObj.post(context,url,entity, "application/json", new AsyncHttpResponseHandler(Looper.getMainLooper()) {
@Override
public void onSuccess(int statusCode,org.apache.http.Header[] headers,byte[] responseBody) {
System.out.println(" Success ="+responseBody);
}
@Override
public void onFailure(int statusCode,org.apache.http.Header[] headers,byte[] responseBody, Throwable error) {
System.out.println( "Failure");
}
});
DownLoad.Class
AsyncHttpClient asynClient = new AsyncHttpClient();
void post(Context context,String url, StringEntity entity,String string, AsyncHttpResponseHandler asyncHttpResponseHandler) {
asynClient.addHeader("Accept", "application/json");
asynClient.addHeader("Content-type", "application/json");
asynClient.post(context, url, entity, "application/json", asyncHttpResponseHandler );
}