1

Let's I have 10 entries in my Firebase real-time database. Now I have to show one entry randomly in a textview. How to do that?

  • See https://stackoverflow.com/q/45145596, https://stackoverflow.com/q/18990206, https://stackoverflow.com/q/52469048 and https://stackoverflow.com/a/46801925 (which is for Firestore, but incredibly thorough and the approaches can also be applied to Realtime Database). – Frank van Puffelen Jul 12 '19 at 16:56

1 Answers1

3

One solution that comes to my mind is you can get all the objects in the particular node at firebase. add those objects one by one in some Data structure.

then you can add a random number generator logic for generating index and fetch the record at that index from your data structure.

Thanks

Relsell
  • 771
  • 6
  • 18