我需要从以下api
的数据数组中获取android中的数据http://www.quandl.com/api/v3/datasets/MULTPL/SP500_REAL_PRICE_MONTH.json?start_date=1915-01-01&api_key=UPqWzYxopvhzdoRt5jTS
我尝试了JSONObject请求和字符串请求
JsonObjectRequest obreq = new JsonObjectRequest(Request.Method.GET, Url.URL_SNP_2,
// The third parameter Listener overrides the method onResponse() and passes
//JSONObject as a parameter
new Response.Listener<JSONObject>() {
// Takes the response from the JSON request
@Override
public void onResponse(JSONObject response) {
Log.d("Response", "Getting CAB Response: " + response.toString());
Toast.makeText(Fragment_CAB_SNP_2.this.getActivity(), "response:" + response.toString(), Toast.LENGTH_LONG).show();
}
// Try and catch are included to handle any errors due to JSON
},
// The final parameter overrides the method onErrorResponse() and passes VolleyError
//as a parameter
new Response.ErrorListener() {
@Override
// Handles errors that occur due to Volley
public void onErrorResponse(VolleyError error) {
Log.e("Volley", "Error");
}
}
);
// Adds the JSON object request "obreq" to the request queue
requestQueue.add(obreq);
但它提供以下异常
E/Volley: [35011] BasicNetwork.performRequest: Request at http://www.quandl.com/api/v3/datasets/MULTPL/SP500_REAL_PRICE_MONTH.json?start_date=1915-01-01&api_key=UPqWzYxopvhzdoRt5jTS has been redirected to https://www.quandl.com/api/v3/datasets/MULTPL/SP500_REAL_PRICE_MONTH.json?start_date=1915-01-01&api_key=UPqWzYxopvhzdoRt5jTS
05-11 23:02:25.134 27238-27238/com. E/Volley: Error
没有得到任何回复。请帮助我