Reputation: 1
Actually, I am working on RecyclerView
that shows some details along with images and all data comes from a database.
In my RecyclerView
, I have used three diffs layout and each layout is used according to data coming from the database that means if only one image comes from database then one_image.xml
layout comes to play, if two then two_imag.xml
layout comes to play and if more than three then the third layout I am using.
My apps working fine for some extents but when i am trying to scroll down further, it get crashed. I come to know that the problem is on OnCreateViewHolder
, meaning it doesn't get called when I go down further in Recycler View.
I searched alots on google but nothing work for me. Is it possible to call OnCreateViewHolder
every time or some other way to solve this problem?
Thanks in advance
Upvotes: 0
Views: 38
Reputation: 560
Sounds like the best option would be to use one layout file that has all three image views but just default them to visibility "gone" so they dont take up space. Then when you need to use them, set them to visibility "visible" when you are creating your viewholder.
Without seeing any actual code it hard to be more specific.
Upvotes: 1