I'm trying to work with Firebase and Lists.
My objects contains a class extending ArrayList such as:
MyClass {
// other fields here
public static class List extends ArrayList<Foo> {};
}
If I try to upload a List
item to Firebase database, it works out of the box and no problem are faced.
The problem come when I try to retrieve these List
s from the server, such as:
MyClass mMyClass = dataSnapshot.getValue(MyClass.class);
This throws an exception saying
com.google.firebase.database.DatabaseException: Can't convert object of type java.util.ArrayList to type mypackage.MyClass$List
The only possible thing working for me is to revert back to ArrayList<Foo>
instead of extending it from another class.
Is there any other possible way to cast without problems? Thanks in advance.