-1

I am trying to use FirebaseRecyclerAdapter in my chat application but it is not displaying anything.

Can anyone help?

Here are my codes: https://gist.github.com/omermujtaba/0f5dfdf0e021be87b875e6ac6b30b403

This is my db structure

xaif
  • 553
  • 6
  • 27
  • 1
    Please read this: https://stackoverflow.com/help/mcve and provice a minimal example inside your question to reproduce your problem, and not the full source code – TheTanic Jul 31 '18 at 12:19
  • I don't know where the problem is that's why I provided the complete code of my chat activity. Please consider. – Omer Mujtaba Jul 31 '18 at 12:22
  • **[This](https://stackoverflow.com/questions/49383687/how-can-i-retrieve-data-from-firebase-to-my-adapter/49384849)** is a recommended way in which you can retrieve data from a Firebase Realtime database and display it in a `RecyclerView` using `FirebaseRecyclerAdapter`. Try to see the differences. – Alex Mamo Jul 31 '18 at 13:23
  • Thankyou @AlexMamo, I was doing all the adapter stuff in onStart, it needed to be done in onCreate. – Omer Mujtaba Jul 31 '18 at 13:48

2 Answers2

0

Try to set adapter in onCreate function or try use this somewhere:

recyclerView.notifyDataSetChanged();

damienG
  • 409
  • 4
  • 10
0

As in my answer from the post that I gave you as an example in my comment above, the difference is that you need to move the creation of the adapter inside the onCreate() method and not to keep it inside the onStart() method. In the last one you should start listening for changes.

Alex Mamo
  • 130,605
  • 17
  • 163
  • 193