【发布时间】:2015-05-08 14:02:08
【问题描述】:
以下 url 的 volley get 请求出现 400 服务器错误
http://query.yahooapis.com/v1/public/yql?q=select * from yahoo.finance.xchange where pair in ('AEDALL')&format=json&env=store://datatables.org/alltableswithkeys&callback=
当我从其他客户端点击相同的 url 时,它会给出 json 响应
这是我的凌空请求代码
private void convertCurrenctVolleyTask(String from, final String to, final String amount) {
String url_yahoo = "http://query.yahooapis.com/v1/public/yql?q=select * from yahoo.finance.xchange where pair in ('"+from+to+"')&format=json&env=store://datatables.org/alltableswithkeys&callback=";
final ProgressDialog progressDialog;
progressDialog = new ProgressDialog(CurrencyConverter.this);
progressDialog.setMessage("Please wait...");
progressDialog.setCancelable(true);
progressDialog.show();
JsonObjectRequest GetCurrenciesjsObjRequest = new JsonObjectRequest(
Request.Method.GET, url_yahoo, null,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
progressDialog.cancel();
if (response != null) {
parseGetCurrencyResp(response,to,amount);
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
progressDialog.cancel();
Toast.makeText(CurrencyConverter.this,
"Server error..", Toast.LENGTH_SHORT).show();
error.printStackTrace();
}
});
ConfigVolley.getInstance().addToRequestQueue(GetCurrenciesjsObjRequest);
}
任何帮助表示赞赏
【问题讨论】:
标签: android android-volley yahoo-api yahoo-finance