I execute the DNITaxistes method, but when I make the call, I do not execute the code of the onSuccess
and neither the one of the onFailure
, it directly exits the method. The searchTaxist method executes another asynchronous call. Any solution?
public void DNITaxistes() {
AsyncHttpClient client = new AsyncHttpClient();
client.get(URL, new AsyncHttpResponseHandler() {
@Override
public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
JSONArray dniTaxistes;
String strResponseBody = new String(responseBody);
try {
dniTaxistes = new JSONArray(strResponseBody);
for(int i=0; i < dniTaxistes.length(); i ++){
DNITaxistaTemporal = dniTaxistes.getString(i);
Log.d("DNI TAXISTA: ",""+ DNITaxistaTemporal);
buscarTaxista();
}
} catch (JSONException e) {
Log.d("error",""+e);
e.printStackTrace();
}
}
@Override
public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
Log.d("ERROR STATUS:"," "+ statusCode);
}
});
}