here is an example of my code. (Dependencies implementation 'com.loopj.android:android-async-http:1.4.11')
AsyncHttpClient asyncHttpClient = new AsyncHttpClient();
asyncHttpClient.addHeader("secret", "123");
JSONObject jsonParams = new JSONObject();
onParams.put("name", "Jon");
asyncHttpClient.post(menu.this, "http://192.168.1.104:8000/", jsonEntity, "application/json", new JsonHttpResponseHandler() {
@Override
public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
super.onSuccess(statusCode, headers, response);
}
@Override
public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse ) {
super.onFailure(statusCode, headers, throwable, errorResponse);
//////////////??????????????????????????????????/////////////////////////
}
});
If the server does not respond, I get into the onFailure method with a TimeOut error, how can I get the body of my request that I sent ( onParams.put("name", "Jon");) ?
i want to get the body of the request i sent