Get Map value from Firebase java

Marek Vondra :

I would like to as you with support.

In Firebase I have document with this hierarchy:

Firebase hierarchy: Firebase hierarchy

In Firebasehandler.java I receive the data from :

for (QueryDocumentSnapshot documentSnapshot : queryDocumentSnapshots) {

   String title = DocumentSnapshot.get(ARG_Firebase_Offer_Title).toString();
   Timestamp dateStartCruise = documentSnapshot.getTimestamp(ARG_Firebase_Offer_DateStartCruise);
   Long numberOfCrew = documentSnapshot.getLong(ARG_Firebase_Offer_MaxNumberCrew);
}

It is working for Long, String and others. Unfortunately I don't know how to receive data from Firebase in format Map.

Thank you very much all for support.

Doug Stevenson :

DocumentSnapshot's get() method will return a Map<String, Object> when the document field is an object. Simply cast it to that type.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=153377&siteId=1