//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");
queryBuilder.setWhereClause(whereClause);
Backendless.Data.of("Master").find(queryBuilder, new AsyncCallback<List<Map>>() {
@Override
public void handleResponse(List<Map> response) {
dataPointsArrayOfIntegers[index] = (int) response.get(0).get("grandTotal");
data.add(new ValueDataEntry(1, dataPointsArrayOfIntegers[0]));
pie.data(data);//This works, but this is NOT what i want
}
@Override
public void handleFault(BackendlessFault fault) {
}
});
pie.data(data);//This DOSENT work (At this point data is null), but this is what i want.