我试图使用Amadeus Airport Autocomplete API。但是它一直返回一个空响应。我刚刚开始请求数据,API's
因此非常感谢您的输入。
JSONdata 如下所示:
[
{
"value": "ROC",
"label": "Greater Rochester International Airport [ROC]"
},
{
"value": "MEE",
"label": "La Roche - Maré Island Airport [MEE]"
},
{
"value": "CAY",
"label": "Cayenne - Rochambeau [CAY]"
}
]
我的代码如下:
private void RequestParams(){
RequestParams params=new RequestParams();
params.put("apikey",API_KEYTRUE);
params.put("term",keyw);
letsDoSomeNetworking(params);
}
private void letsDoSomeNetworking(RequestParams params){
Log.d("PlanSky","Entered Letsdosomenetworking");
//Async Http
AsyncHttpClient client =new AsyncHttpClient();
client.get(FIN_URL,params,new JsonHttpResponseHandler(){
@Override
public void onSuccess(int statusCode, Header[] headers, JSONArray response) {
Log.d("PlanSky","Success");
try {
Log.d("PlanSky", "response" +response);
}
catch(Exception e){
Log.d("PlanSky","Exception"+e);
}
}
@Override
public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) {
Log.d("PlanSky","Error Encountered");
}
});
}
JSONobject
我尝试从响应中请求 aJSONObject obj=response.getJSONObject(0);
但它也没有返回任何内容
logcat 输出如下:
D/PlanSky: Button Clicked
D/PlanSky: Entered Letsdosomenetworking
D/PlanSky: Success
D/PlanSky: response[]