gpt4 book ai didi

android - onFailure 未被调用 - onFailure(...) 未被覆盖,但已收到回调

转载 作者:行者123 更新时间:2023-11-29 15:47:27 26 4
gpt4 key购买 nike

我正在使用来自 Loopj 的 android-async-http 库,我的代码中没有调用 onFailure,我已经尝试了所有三种方法..

W/JsonHttpRH:onFailure(int, Header[], String, Throwable) 没有被覆盖,但是收到了回调

private void get() {
//Request parameters
RequestParams params = new RequestParams();
params.put("key", API_KEY);

MyRESTClient.get("/posts/", null, new JsonHttpResponseHandler() {
@Override
public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
//some code
}

@Override
public void onProgress(long bytesWritten, long totalSize) {
mLoaderProgress.setText((long) 100 * bytesWritten / totalSize + "Loading...");
}

@Override
public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) {
super.onFailure(statusCode, headers, throwable, errorResponse);
Log.d("Error----> ", ""+statusCode+" ------ "+ errorResponse);
}
});

}

最佳答案

下面是正确的覆盖方法,

public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) {
super.onFailure(statusCode, headers, responseString, throwable);
Log.d("Failed: ", ""+statusCode);
Log.d("Error : ", "" + throwable);
}

关于android - onFailure 未被调用 - onFailure(...) 未被覆盖,但已收到回调,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32326616/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com