无法解析符号'

时间:2017-06-30 13:52:08

标签: java android

在这个JsonResponse

private void handleReserveResponse (final String res) {

        if (res != null){

            try {

                JSONObject objResponce = new JSONObject(res);
                String success = objResponce.getString("success");
                if (success.equals("true")) {

                    JSONArray arrdata = objResponce.getJSONArray("disponibilidad");
                    for (int i = 0; i < arrdata.length(); i++) {

                        JSONObject objdata = arrdata.getJSONObject(i);
                        String listDatesA = objdata.getString("slot_date");

                        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");

                        dateA = format.parse(listDatesA);

                        calendar = Calendar.getInstance();
                        calendar.setTime(dateA);

                        CalendarDay calendarDay = new CalendarDay.from(calendar);
                    }
                }

            } catch (Exception e) {
                e.printStackTrace();
            }

        }else {
                DialogAlert.show_alert_dialog(getActivity(), getResources().getString(R.string.result_null_msg));
            }

    }

我希望将不同日期存储在String listDatesA并将其转换为Date

但是在CalendarDay calendarDay = new CalendarDay.from(calendar);

.from显示为红色,显示错误Cannot resolve symbol 'from'

在另一个项目中探测此代码并没有出现此错误。我尝试File-&gt;使捕获/恢复无效但不起作用。我该如何解决呢

1 个答案:

答案 0 :(得分:0)

改变这个:

CalendarDay calendarDay = new CalendarDay.from(calendar);

到此:

CalendarDay calendarDay = CalendarDay.from(calendar);