I have an ArrayList<Integer> with values (20, 40, 60, 80, 100, 120) Is it possible to only retrieve the position 2-5 only which is 60, 80, 100 and 120? Thanks for any help.
for (DataSnapshot price : priceSnapshot.getChildren()) {
int pr = price.getValue(Integer.class);
priceList.add(pr); // size is 61
}
int total = 0;
List<Integer> totalList =
new ArrayList<Integer>(priceList.subList(29, 34));
for (int i = 0; i < totalList.size(); i++) {
int to = totalList.get(i);
total += to;
txtPrice.setText(String.valueOf(total));
}