2014-09-06 2 views
0

GET 요청을 수행 할 사람 : http://www.opensecrets.org/api/?method=getLegislators&apikey=xxx&output=json&id=ny android asynchttp 1.4.3. 나는 여러 중단 점을 설정하지만, 예외가 발생되지 않고 다음 콜백 중 어느 것도 호출되지되고있다 :jsonHttpResponseHandler 콜백이 호출되지 않음

APIclient.getLegislators(this, enteredState, new JsonHttpResponseHandler() { 
     @Override 
     public void onSuccess(JSONArray arr) { 
      String s= "hello"; 
     } 

     @Override 
     public void onSuccess(JSONObject contactsJson) { 
      ArrayList<Contact> contacts = Contact.fromJSON(contactsJson); 
     } 

     /*@Override 
     public void onFailure(int statusCode, org.apache.http.Header[] headers, byte[] responseBytes, java.lang.Throwable throwable) { 
      //super.onFailure(statusCode, headers, responseBytes, throwable); 
     }*/ 

     @Override 
     public void onFailure(Throwable arg0, JSONArray arg1) { 
      super.onFailure(arg0, arg1); 
      Toast.makeText(getApplicationContext(), 
        "Failed with JSONArray 2nd arg!", Toast.LENGTH_LONG).show(); 
     } 

     // If it fails it fails here where arg1 is the error message(dev inactive) 
     @Override 
     public void onFailure(Throwable arg0, String arg1) { 
      super.onFailure(arg0, arg1); 
      Toast.makeText(getApplicationContext(), 
        "getTrailerUrl failed with String 2nd arg!", 
        Toast.LENGTH_LONG).show(); 
     } 

     @Override 
     public void onFailure(Throwable arg0, JSONObject arg1) { 
      super.onFailure(arg0, arg1); 
      Toast.makeText(getApplicationContext(), 
        "Failed with JSONObject 2nd arg!", Toast.LENGTH_LONG).show(); 
     } 

    }); 

내가 그 자바 독을 바탕으로 http://loopj.com/android-async-http/doc/com/loopj/android/http/JsonHttpResponseHandler.html

을 검토하여이의 이해를 얻기 위해 노력했다, 내가 입력 콜백이 주석 처리 된 것을 볼 수 있습니다. 나는 컴파일러가 그러한 부모 onFailure 서명을 인식하지 못했기 때문에 주석 처리했다. 아직 onFailure의 컴파일러 오류는 공식 문서에 나와 있지 않습니다.

Loopj Android Async Http - onFailure not fired 내가 놓친 게 무엇 콜백 재정의 : 그 후 2012 년 다시 이후

이의 솔루션은 SO 분명히 내가 가지고있는 항아리에 합병되었다가 게시? 내 GET 요청이 성공하지 못하는 이유를보고 싶습니다. 감사합니다

답변

0

내 앱이 매니페스트의 인터넷에 액세스하는 것을 잊었습니다. 내 코드의 콜백과 일치하지 않는 문서에 대해서는 안드로이드 비동기 1.4.3 jar 소스의 서명이 내 재정의와 일치하기 때문에 버전이 일치하지 않을 수 있습니다.

관련 문제