What is the correct way to recover an Arraylist<Long> from the firestore cloud?

Asked

Viewed 27 times

0

I am using the following code to try to recover an Arraylist from the firestore:

List<Long> longs = (List<Long>) task.getResult().getDocuments().get(i.get()).get("longsArray");

However I’m not sure I’m doing this the right way, because I’m fearing the following mistake:

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.exemplifique.project, PID: 14521
    java.lang.RuntimeException: Could not deserialize object. Class java.util.ArrayList has generic type parameters, please use GenericTypeIndicator instead

1 answer

0

As the return of the API is already specified, you can do as follows:

List<Long> longs = (ArrayList<Long>) task.getResult().getDocuments().get(i.get()).get("longsArray");

Browser other questions tagged

You are not signed in. Login or sign up in order to post.