Hi, am using android API. I have a table in the backendless console, name contributions. In that table there is a column for amount. My problem is, when i get the total amount of all the columns, i keeps on changing. Here’s the code
//get the total contribution amount
Backendless.Persistence.of(Contributions.class).find(new AsyncCallback<BackendlessCollection<Contributions>>() {
@Override
public void handleResponse(BackendlessCollection<Contributions> contributionsBackendlessCollection) {
contributions = contributionsBackendlessCollection;
int cSize = contributions.getData().size();
//sum up the contributed amount
for (int i = 0; i < cSize; i++) {
contributedAmount += contributions.getData().get(i).getContribution_amount();
}
balanceAmount = requiredAmount - contributedAmount;
Log.d("Balance is ;;;; ", "" + balanceAmount);
actualContributedField.setText(String.valueOf(contributedAmount));
balanceField.setText(String.valueOf(balanceAmount));
Log.d("Size of data", String.valueOf(cSize) + " Total is " + contributedAmount);
}
@Override
public void handleFault(BackendlessFault backendlessFault) {
Toast.makeText(SummaryActivity.this, backendlessFault.getMessage(), Toast.LENGTH_SHORT).show();
}
});
the amount keeps on changing whenever i refresh that. How can i make the pulled amount not to change?? Because its supposed to be constant amount from the saved data.