1

How to create a model class with this firebase structure?

enter image description here

So the first node inside the group_messages is UserId inside that is Group_id and inside that is the message_id.

I want to get all the group_message data and display it to my app. So I am using RecyclerView.Adapter and in order to do that I need to have a model class. This is my model class (GroupMessages.java)

public class GroupMessages {

//TODO: Get the list of seen node;

private String message, from, type;
private long time;

public String getMessage() {
    return message;
}

public void setMessage(String message) {
    this.message = message;
}

public long getTime() {
    return time;
}

public void setTime(long time) {
    this.time = time;
}

public String getFrom() {
    return from;
}

public void setFrom(String from) {
    this.from = from;
}

public String getType() {
    return type;
}

public void setType(String type) {
    this.type = type;
}
}
Kush
  • 355
  • 2
  • 20
  • 1
    **[This](https://stackoverflow.com/questions/49383687/how-can-i-retrieve-data-from-firebase-to-my-adapter/49384849)** is how you can retrieve data from a Firebase Realtime database and display it in a `RecyclerView` using `FirebaseRecyclerAdapter`. – Alex Mamo May 15 '18 at 15:10
  • Let me point out that you need an empty constructor on that class to be able to read data from Firebase – Rosário Pereira Fernandes May 15 '18 at 18:53
  • my only problem is the seen list. I want to get all the ids and store it in an arraylist –  May 16 '18 at 00:42
  • Hi even I'm having a similar structure, how did you form the model class? Thanks – Arjun Sep 19 '20 at 18:24

0 Answers0