尝试创建一个简单的电影放映时间移动应用程序。我之前在另一个类中使用过this方法,它可以正常工作,但是由于某种原因,在当前类中我收到404错误。
client.get(String.format(VIDEO_URL, 209112), new JsonHttpResponseHandler() {
@Override
public void onSuccess(int statusCode, Headers headers, JSON json) {
try {
JSONArray results = json.jsonObject.getJSONArray("results");
if(results.length() == 0){
return;
}
String youtubeKey = results.getJSONObject(0).getString("key");
} catch (JSONException e) {
Log.e("DetailActivity", "Failed to parse JSON", e);
}
}
@Override
public void onFailure(int statusCode, Headers headers, String response, Throwable throwable) {
System.out.println("On failure again " +statusCode + " response: " + response);
}
});
我的gradle文件中也有它的依赖项行。
implementation 'com.codepath.libraries:asynchttpclient:0.0.9'
这是我收到的onFailure消息
On failure again 404 response: {"status_code":34,"status_message":"The resource you requested could not be found."}
答案 0 :(得分:0)