HarrisonT
HarrisonT

Reputation: 41

How to populate a recyclerview

I am setting up a Firebase Android application, similar to a chat forums app, and need to know how to call the data in order to populate the recycler view. I know about denormalizing the data, but for the most part I haven't gotten to the part where I create duplicate data and assign the value to true, so I have the following data.

Database Structure

{
  users: {
    userId1: {
      name: "Me"
      photo: "www.abc.com"
      }
    }
  }
  threadowner: {
    userId1: {
      topics: {
        topicA: true
        topicC: true
        topicH: true
      }
    }
  }
  topicnames: {
    topicA: {
      owner: "userId1"
      subject: "blah blah"
      timestamp: 1132445
    }
    topicB: {
      owner: "userId2"
      subject: "blah blah"
      timestamp: 1132445
    }
    topicC: {
      owner: "userId1"
      subject: "blah blah"
      timestamp: 1132445
    }
  }
}

And I have an Activity that has a RecyclerView.

So what I want to learn to do is how can I utilize this threadowner list where userId1 created topicA, topicC, and topicH to populate the recyclerview list, and on this list show the subject and the timestamp for these respective topics that were created by userId1.

Upvotes: 0

Views: 65

Answers (1)

user7571182
user7571182

Reputation:

Have you tried it on your own? For an instance you can use FirebaseListAdapter.

There is also a library called FirebaseUI that includes a FirebaseRecyclerAdapter and many things more. I highly recommend that you use this and practice over with different adapters present in it.

Here is a link that will help you:

https://github.com/thaleslima/Chat-Firebase/tree/master/app/src/main/java/com/gdgcampinas/chat_firebase

Upvotes: 1

Related Questions