Just create a list and add items to it,
List<Integer> checkedList = new ArrayList<Integer>();
for (Product p : boxAdapter.getBox()) {
if (p.aBoolean)
checkedList.add(p.id);
}
I would suggest you work on your basics before you start coding, it will help you in such situations.
Hope this is the solution you were looking for.
0
solved How to add numbers for arraylist