I'm trying to create an application that can read the values from a Firestore array and put them into an ArrayList or something, this is my code:
ArrayList<Integer> driverPermissions = new ArrayList<>();
Firestore.collection("Admins").document("1234567890").get().addOnCompleteListener(task -> {
DocumentSnapshot document = task.getResult();
driverPermissions = document.get("Test");
});
Unfortunately, it doesn't work. It marks me as an error in this line:
driverPermissions = document.get("Test");
And the error is:
Variable used in lambda expression should be final or effectively final
How can I add the values present inside the array on Firestore into an ArrayList or something like that and then use that throughout the code? And not only within the method?