I had seen lot of tutorials, but everywhere they have used dummy data while implementing heterogeneous Recyclerview( Text type, image type and video type posts in same recycler view).
Firebase database node structure: Firebase database
Timeline
|---XqAWXQry50djimz8A5vg0sxskC43
|----LI0FKzQH4YhMEOePT91
|---text_message:"the best painter in past centur"
|---name: "Rahul"
|---profile_pic:"https://firebasestorage.google..
|---Image_post:"default"
|----KY1TWaSZ2MnRSXaCD68
|---text_message:"default"
|---name:"rahul"
|---profile_pic:"https://firebasestorage.google....
|---Image_post:"https://firebasestorage.google.com/
My model class:
Fmodel.java
My First question is: How can i use constructor within the adapter class to retrive these data values from model class.
My Second question is: In the database structure i shared, First post is Text post and Second is Image post, how can i differentiate in the getItemViewType method in the adapter class.
From one of the fragment.java file in my project am setting the atributes setHasFixedSize(true) and setLayoutManager(linearLayoutManager). I have implemented recyclerview couple of times but with only one view type posts.
I have created adapter class, and seperate viewholders for text posts and image posts..But the basic thing is how can i retrieve model class dtata items using constructor within adapter class and how do i differentiate b/n
text post and image post within getItemViewType method.
Adapter class rough snippet:Adapter class