Generic RecyclerView Adapter
Iโm writing this article in the situation when the whole world is lockdown due to Covid-19 but the developers donโt stop working ๐
Here is the code for generic RecyclerView Adapter:
Hereโs how you can use it:
val apples = arrayListOf(
Apple(5f, 50f),
Apple(6f, 55f),
Apple(7f, 60f),
Apple(8f, 65f)
)
rv.showData(
apples, R.layout.rv_list_item
) { _, itemData, itemView ->
(itemView as TextView).text = itemData.size.toString()
}
apples.add(Apple(9f, 66f))
rv.refresh()
Hope you liked this article!
Medium does not allow Indian writers to monetize currently ๐ญ. Please support this blog by contributing here: https://www.patreon.com/malwinder ๐ฅฐ
Even a small contribution would help ๐
If you have any questions, then please write down a response in the response section.
If you liked this article, then please press the ๐ icon.
Thank you!
Peace! ๐