LazyColumn vs RecyclerView!!
We are using LazyColumn in Jetpack Compose, let's see how they differ from each other and how they work.
1. Re-using views: Unlike re-using already created views like RecyclerView, lazyColumn uses a lazy list which emits a new view whenever we scroll. Which seems expensive but it is less than 80% less expensive than creating new views in Android old ways. Because once a comparable view is created it doesn't need full resources to create again as it is already stored as composable something like inline functions in Kotlin. Whenever it is called it just emits a new view with the data and even the data change doesn't need the full resource to change as it just refreshes that part of the view only not the whole list or even the whole item.
2. Using of Modifier and Adapter: As RecyclerView uses an adapter Lazy Column does not. LazyColumn uses a modifier like any composable in JetpackCompose to modify anything in the lazy column
3. On Data Changes: LazyColumn do not need any function like onItemChanged because it's so efficient on its own. Because when new data is added or inserted, the changed Lazy column will only change that specific item not the whole list. So it is less tricky and expensive of changing data in recycler views.
4. Adapter Creation: LazyColumn does not need any adapter creation, you must submit the list and that's it. Everything will be controlled by it.
Here are the main four different key advantages over RecyclerView in the lazy column. What do you think about which one is better and which one are you using?
Subscribe to my newsletter
Read articles from Fakhrul Siddiqei directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Fakhrul Siddiqei
Fakhrul Siddiqei
I am an Software Engineer from Bangladesh, working with mobile development since 2017. I love to learn new technologies and use them in my development. Learning and letting other's know about new technologies and programming tech is my hobby.