java - 我在将值从 JSON 对象赋值给局部变量时遇到问题,调试器显示变量 = 'this' 不可用

标签 java android json android-json

The first time it is working fine , after some testing I got this problem.

i cant get value from Json Object , the Json Array is fine , but value not assinged.

我正在使用 Andorid StudioVolley 用于从 Json 格式 的网络服务器获取响应。

StringRequest postRequest = new StringRequest(StringRequest.Method.POST, syncURL,
                new Response.Listener<String>() {
                    @Override
                    public void onResponse(String response) {
                        try{
                            long TempResponse = response.length();
                            if (TempResponse <= 2){
                                udo_Core.udfShowMessage("Error","Error In Getting Data From Server!",udo_temp_activity);
                            }else {
                                JSONArray arr = new JSONArray(response);
                                for (int i = 0; i < arr.length(); i++) {
                                    JSONObject mJsonObject = arr.getJSONObject(i);
                                    try{
                                        udo_entry_max_BAR = mJsonObject.getLong("maxentryno");
                                        udo_entry_min_BAR = mJsonObject.getLong("minentryno");
                                        udo_entry_no_BAR  = udo_entry_min_BAR;
                                        udo_entry_no_MAX  = udo_entry_max_BAR;
                                    }catch (Exception e){
                                        e.printStackTrace();
                                    }

                                    //udo_PRB_Limit       = 100/(udo_entry_max_BAR-udo_entry_min_BAR);
                                }

                            }
                        }catch (JSONException e){
                            e.printStackTrace();
                        }
                    }
                },
                new Response.ErrorListener()
                {   @Override
                    public void onErrorResponse(VolleyError error){
                        error.printStackTrace();
                    }
                }
        ){
            @Override
            protected Map<String, String> getParams()
            {
                Map<String, String>  params = new HashMap<String, String>();
                params.put("query", udoQuery);
                params.put("type", type);
                params.put("companycode", "");
                params.put("p_fm_loc", "");
                params.put("p_to_loc", "");
                params.put("p_fm_date", "");
                params.put("p_to_date", "");
                return params;
            }
        };
        postRequest.setRetryPolicy(new DefaultRetryPolicy(12000,
                DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
        udoVolleyQuery.add(postRequest);

while Debugging , inside the loop assign value from Json Object to Local variable but In Debugger window shows " udo_entry_max_BAR = 'this' is not Available "

最佳答案

这仅在调试器窗口中显示,执行完成后您将获得值。

关于java - 我在将值从 JSON 对象赋值给局部变量时遇到问题,调试器显示变量 = 'this' 不可用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56712704/

相关文章:

java - 在 GXT 中,何时为日期触发更改事件

java - 提取参数化类型的值时,将参数化类型类参数转换为子类形式

java - Java (Android) : convert byte[] to String, 数字形式

javascript - JSON Javascript转义

json - 如何存储参数化方法的类型参数,然后使用它们将 JSON 对象转换为泛型类型的普通对象?

java - 使用Java中的批处理请求和nextPageToken从Google Drive Api获取超过1000个文件

java - 变量作为图表中的参数

android - 如何更改微调器背景颜色?

Android:Google Maps API Key Signup : MD5 认证 key

json - (un)编码json golang不起作用