I want to put a list of items I am extracting from a firebase database. I was using RecyclerView for this but now I came to know that we can create Buttons, TextViews etc programmatically. I was wondering if there are any benefits of recyclerview or any special cases where it is preferable to use recyclerview.
-
1you probably lack information of how RecyclerView works. Likely any lesson about RecyclerView explains it's benefits. – Vladyslav Matviienko Jun 04 '19 at 07:52
-
@VladyslavMatviienko You are right. That's why I came here. Can you suggest some source to gain more knowledge about this? It would be really helpful. – Pandey Jun 04 '19 at 07:59
-
this is totally wrong place to ask for a tutorial. Use google to find one, there is 99% chance that the one you find will explain the recyclerview benefits. – Vladyslav Matviienko Jun 04 '19 at 08:01
-
I asked a doubt you told me that I lack information about RecyclerView. That's why I asked if you have any reliable sources. I know I wasn't supposed to ask, but you seem like a knowledgable person so I was asking for some recommendation. Sorry about that. – Pandey Jun 05 '19 at 06:41
2 Answers
Use RecyclerView, it is memory efficient. It does create view when it is visible and destroys it when it is not visible anymore, this way you can have infinite list without using a lot of resources.

- 3,036
- 1
- 16
- 34
-
to be precise, it is not destroying views when they are not visible. It is reusing them for the visible items. – Vladyslav Matviienko Jun 04 '19 at 07:57
-
So if I have a small list then it would be ok to use any of these two methods? – Pandey Jun 04 '19 at 07:57
-
You could never know when your list gets bigger, use always RecyclerView and forget ListView :) – Antonis Radz Jun 04 '19 at 07:58
Not bad thing to maintain view dynamically, But you need to know full concept of recycler view before taking the decision because there are lot's of aspect depend on when you are deciding to any component
Key aspects,
- Why you are using view?
- Is it sequential?
- All the data in the list are the same type?
- Also, How many records in the list if there is only tow-three record then no need to take the recyclerview.
Ultimately recyclerview is the optimized view for list out the item as a list,
Also, we suggest if your most of the data same type then take recyclerview don't do at dynamically, Because name self saying how recycler view (Recycle) will work

- 4,589
- 1
- 23
- 39