Values are being sent null

2

For some reason the arrays are being sent null in setListGrades, however inside the log shows the normal arrays. The API is being consumed correctly, so why is it null in sending this method?

                    @Override
                    public void onNext(GradeModel grades) {

                        BigDecimal[] gradesList = new BigDecimal[grades.getReportLists().length];
                        Integer[] faultsList = new Integer[grades.getReportLists().length];
                        String[] classesList = new String[grades.getReportLists().length];

                        for (int i = 0; i < grades.getReportLists().length; i++) {
                            gradesList[i] = grades.getReportLists()[i].getGradesList();
                            faultsList[i] = grades.getReportLists()[i].getFaultList();
                            classesList[i] = grades.getReportLists()[i].getClassList();
                        }
                        Log.i(TAG, "caralhoooooo " + Arrays.asList(classesList) + Arrays.asList(gradesList) + Arrays.asList(faultsList));
                        mainPresenter.setListGrades(gradesList, faultsList, classesList);

                    }
                });
    
asked by anonymous 23.04.2017 / 17:28

1 answer

1

Maybe if you did as below, would solve:

List<BigDecimal> gradesList = new ArrayList<BigDecimal>();
List<Integer> faultsList = new ArrayList<Integer>();
List<String> classesList = new ArrayList<String>();

for (int i = 0; i < grades.getReportLists().length; i++) {
    gradesList.add(grades.getReportLists()[i].getGradesList());
    faultsList.add(grades.getReportLists()[i].getFaultList());
    classesList.add(grades.getReportLists()[i].getClassList());
 }
Log.i(TAG, "caralhoooooo " + Arrays.asList(classesList) + Arrays.asList(gradesList) + Arrays.asList(faultsList));
 mainPresenter.setListGrades(gradesList, faultsList, classesList);

or possibly

mainPresenter.setListGrades(gradesList.toArray(), faultsList.toArray(), classesList.toArray());

If you get any problems let us know that we try to solve them differently.

    
24.04.2017 / 14:25