对比分析json及XML(9)


JsonObjectRequest jsonObjRequest = new JsonObjectRequest(Request.Method.GET, url, null,
        new Response.Listener<JSONObject>() {
            @Override
            public void onResponse(JSONObject response) {
                try {
                    MyLog.d(TAG, "response=" + response);
                    parseiQiyiInterfaceResponse(response);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
                /*
                 * if (error instanceof NetworkError) { } else if (error
                 * instanceof ClientError) { } else if (error instanceof
                 * ServerError) { } else if (error instanceof
                 * AuthFailureError) { } else if (error instanceof
                 * ParseError) { } else if (error instanceof
                 * NoConnectionError) { } else if (error instanceof
                 * TimeoutError) { }
                 */
                MyLog.e(TAG, "onErrorResponse, error=" + error);
            }
        }) {
    @Override
    public Map<String, String> getHeaders() throws AuthFailureError {
        HashMap<String, String> headers = new HashMap<String, String>();
        headers.put("t", iQiyiInterface.getEncryptTimestamp());
        headers.put("sign", iQiyiInterface.getSign());
        return headers;
    }
};

  第二步,获取到对应的对应的JSONObject数据:

复制代码 代码如下:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wgswyx.html