简体   繁体   English

我如何才能像事件一样使用 Firebase 访问 DataSnapshot,只有没有事件? 所以我只想从孩子那里读出数据

[英]How can I access DataSnapshot with Firebase like an event, only without an event? So I just want to read out data form a child

How can I access DataSnapshot with Firebase like an event, only without an event?我如何才能像事件一样使用 Firebase 访问 DataSnapshot,只有没有事件? So I just want to read out data.所以我只想读出数据。 But in the form of the data snapshot但是以数据快照的形式

So in the app I access with mFirebaseRef.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) {... } to the database. But if I want to read out data when starting the app, I don't have the functions from the above example.因此,在应用程序中,我使用mFirebaseRef.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) {... }访问数据库。但是如果我想在启动应用程序时读出数据,我不会t 具有上述示例中的功能。

Use get()使用 get()

Comment from Jay: I think you're asking how to Read Data Once which uses get() and does not throw an event.杰伊的评论:我想你是在问如何使用 get() 并且不引发事件的读取数据一次。 was right是正确的

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我如何在需要时而不只是在 DataChange 时从 firebase 实时数据库中读取数据 - how can i read data from firebase realtime database when i want and not just when DataChange 我可以在不发生事件的情况下将数据写入 firebase 吗? - Can i write data to firebase without making an event? 如果给定的字符串是给定的 firebase 位置的子项而不下载 firebase 中的整个数据快照,我如何获得 boolean 的值? - How do I get boolean value if given string is child of given firebase location without downloading whole datasnapshot in firebase? Firebase 实时数据库 DataSnapshot only 读取子项中的最后一个值 - Firebase Realtime Databse DataSnapshot only Read the last value in the child 我如何将数据放在 firebase 中的孩子之外,我遇到的问题看起来像这样 - How can i put data outside of child in firebase, i having problem look like this 为什么在使用dataSnapshot时无法从Firebase获取一些数据 - Why I can't get some data from Firebase when I use dataSnapshot 我怎样才能标记一个Sentry事件? - How can I tag just one Sentry event? 我想在DoubleClick事件中显示一些文本怎么办? 我已经附上我的源代码 - I want to display some text onDoubleClick event how to do so ? i have attached my sourcecode Along 我在哪里可以放置鼠标事件处理代码,以便它不在路上,但仍然可以操纵对象? - Where can I put mouse event handling code so that it is out of the way but can still manipulate objects? 如何从Firebase数据库中仅获取一个数据? - How can i bring just one data from firebase database?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM