【发布时间】:2021-12-11 07:50:31
【问题描述】:
我刚开始学习安卓。我想知道一种方法,我可以使用仅包含 HashMap 键和值的 firebase 文档字段填充 RecyclerView。对不起,如果我问错了问题。我只想知道有没有可能?this is the snapshot of my firebase
请注意- 我知道如何将项目(我存储在地图中)作为单独的文档存储在集合中并制作 RecyclerView。目前,我仅使用此方法并填充 RecyclerView。但我不想将这些项目存储为单独的文档。
这是所需的输出...Required reyclerview
public class ModelTrans{
Double RecentAmount;
String TransText;
String Transactionid;
@ServerTimestamp
Date date;
int img;
public ModelTrans() {
}
public ModelTrans(Double recentAmount, String transText, String transactionid, Date date, int img) {
RecentAmount = recentAmount;
Transtext = transText;
Transactionid = transactionid;
this.date = date;
this.img = img;
}
......other getter setters
}
【问题讨论】:
-
是的,这是可能的。你都尝试了些什么?你用的是 Java 还是 Kotlin?
-
@AlexMamo 我正在使用 java....但我不想创建单独的文档,因为读取的文档成本很高。
-
好的,我马上给你写答案。
标签: java android firebase google-cloud-platform google-cloud-firestore