在我的应用程序中,我想从 firebase 获取分页为 10 的最新记录。此外,当限制达到 10 时,我想在 listview 中显示它们,然后它应该再次调用接下来的 10 条记录,依此类推。 谁能帮助我如何做到这一点。
最佳答案
为了对 Firebase 记录进行排序,您可以采取一种解决方法。更新或添加记录时添加一个额外字段。该字段只是时间戳,然后按时间戳简单使用顺序。希望这有帮助。
item.timestamp = firebase.database.ServerValue.TIMESTAMP
firebase.database().ref('posts').orderByChild('metrics/timestamps');
关于android - 从 firebase 获取最新的帖子/数据,在 android 中限制 10 条记录并填充到 Listview 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38520748/