1

I'm trying to do a get with AsyncHttpClient, but doesn't enter in both methods, in Postman it's going well, any idea what could be?

AsyncHttpClient client = new AsyncHttpClient();
    String URL = "http://link/link1/link2";
    client.get(URL, new AsyncHttpResponseHandler() {
        @Override
        public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
            JSONArray dni;

            String strResponseBody = new String(responseBody);

            try {
                dni = new JSONArray(strResponseBody);
                for(int i=0; i < dni.length(); i ++){
                    dniTemporal = dni.getString(i);
                    Log.d("DNI : ",""+ dniTemporal );

                }

            } catch (JSONException e) {
                Toast.makeText(JourneyDetails.this, "Error", Toast.LENGTH_SHORT).show();
            }
        }

        @Override
        public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
            Log.d("ERROR STATUS:"," "+ statusCode);
        }

    });
Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Luis
  • 39
  • 1
  • 4

0 Answers0