小编eug*_*ngt的帖子

Android Volley 多个请求

我尝试在当前的 volley 请求中执行一个新的 volley 请求,但是当调用新请求时,它不会进入 onrespond 方法。

新的请求应该在第一次结束之前执行。(后进先出)

如何成功执行新请求?

private void makeJsonObjectRequest() {
    ac = new AppController();


    final JsonObjectRequest jsonObjReq = new JsonObjectRequest(Request.Method.GET,
            url, null, new Response.Listener<JSONObject>() {

        @Override
        public void onResponse(JSONObject response) {
            Log.d("test", response.toString());

            try {
                // Parsing json object response
                // response will be a json object


                JSONArray name = response.getJSONArray("data");
                for (int i = 0; i < name.length(); i++) {
                    JSONObject post = (JSONObject) name.getJSONObject(i);

                    try {
                        objectid = post.getString("object_id");

                        newRequest(objectid);

                    }
                    catch (Exception e) { …
Run Code Online (Sandbox Code Playgroud)

android json android-volley

5
推荐指数
1
解决办法
1万
查看次数

标签 统计

android ×1

android-volley ×1

json ×1