Okay so here me out on this! If you are planning on using Firebase and you have created any custom class to store a custom type for your project please read through these two links.
I spent many hours trying to store a custom type / object into Firebase (containing many different fields like: String, int, ArrayList, etc.) and I wanted to be able to reference this stored data for some functionality of my application.
It turns out that the "DataSnapshot" type that is provided in the Firebase package has a method for getting all immediate children of the current DB reference point. So, you are able to store this into your own custom type by the following code.
=======================================================================
Declare a global list to store the data to:
ArrayList list = new ArrayList<>();
...
list = new ArrayList<>();
list.clear();
myRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
DataSnapshot d = dataSnapshot.getChildren;
CustomType q = d.getValue(CustomType.class);
list.add(q);
// Now from here you are able to do any get() methods you have defined in your
own custom class and a way to test this until you figure out how you want to use it
is as follows!
ToastToast.makeText(this, ""+list.get(0).getName(),Toast.LENGTH_SHORT).show();
}
}
=======================================================================
https://firebase.google.com/docs/reference/android/com/google/firebase/database/DataSnapshot#getChildrenCount()
https://stackoverflow.com/questions/38652007/how-to-retrieve-specific-list-of-data-from-firebase
If you need any additional clarification on this let me know during class and I can hopefully assist you.