Firestore get DocumentSnapshot's field's value

后端 未结 5 577
盖世英雄少女心
盖世英雄少女心 2021-02-02 09:10

If I have a Firebase Firestore database which I have retrieved a DocumentSnapshot for the document corresponding to the collection on the right and stored in a

5条回答
  •  礼貌的吻别
    2021-02-02 10:12

    DocumentSnapshot has a method getString() which takes the name of a field and returns its value as a String.

    String value = document.getString("username");
    

提交回复
热议问题