Support Topics Documentation Slack YouTube Blog

Variable access outside query

//How can i update a variable i declared outside a query inside the handleResponse and still access the updated quantity in that variable outside the query?

String whereClause = “AdvertTitle LIKE %car%”;
List data = new ArrayList<>();
int[] dataPointsArrayOfIntegers = new int[5];
Pie pie = Chart.pie();

            DataQueryBuilder queryBuilder = DataQueryBuilder.create().setProperties("Sum(NumberOfViews) as grandTotal");
            Backendless.Data.of("Master").find(queryBuilder, new AsyncCallback<List<Map>>() {

                public void handleResponse(List<Map> response) {

                   dataPointsArrayOfIntegers[index] = (int) response.get(0).get("grandTotal");
                    data.add(new ValueDataEntry(1, dataPointsArrayOfIntegers[0]));
          ;//This works, but this is NOT what i want

                public void handleFault(BackendlessFault fault) {

            });;//This DOSENT work (At this point data is null), but this is what i want.

Duplicate of Variable Access