Java 不会调用jsonHttpResponseHandler回调
我正在请求:使用android asynchttp 1.4.3。我设置了多个断点,但没有引发异常,也没有调用以下回调:Java 不会调用jsonHttpResponseHandler回调,java,android,android-async-http,Java,Android,Android Async Http,我正在请求:使用android asynchttp 1.4.3。我设置了多个断点,但没有引发异常,也没有调用以下回调: APIclient.getLegislators(this, enteredState, new JsonHttpResponseHandler() { @Override public void onSuccess(JSONArray arr) { String s= "hello"; }
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();
}
});
我试图通过复习来理解这一点
基于javadoc,我输入了您看到的已注释掉的回调。我把它注释掉了,因为编译器没有识别出任何这样的父onFailure签名。然而,官方文档中没有显示不会产生编译器错误的onFailure
这篇文章中的解决方案显然与我在2012年发表的文章中的jar合并了:
我错过了什么?我想知道为什么我的GET请求没有成功。谢谢我忘了在清单中允许我的应用程序访问互联网。至于与我的代码回调不匹配的文档,版本可能不匹配,因为我的android async 1.4.3 jar源代码中的签名与我的重写一致