Retrieve all data under node in firebase realtime database

前端 未结 2 1409
悲哀的现实
悲哀的现实 2021-01-28 06:40

I have a firebase realtime database and want to use the data to make a leaderboard. Im trying to retrieve all the data in my Scores node but am not sure how to loop through to g

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-28 06:56

    It appears as though you are using a "Listener" class to access the data and print out the scores. The "ValueEventListener" listener you attached, with the "onDataChange()" method implemented, would not be called until there is a data change.

    I'm not sure how you are using this class, but based on your question, I am assuming that you just want to print the scores when the "leaderboard.onCreate()" method is executed. Is this correct? If that is the case, you may not need to be attaching a listener.

提交回复
热议问题