In my main activity have 3 fragments in bottom navigation.

Assume fragment1, fragment2, fragment3.

fragment1 & 2 have recyclerview both need to list same content but different records. Now adapter name is recordAdapter is the class. I am using same adapter class in both recylerview. It is right or wrong? Then Why?

Ex : I planned to show India and Australia Football team players list name and images in recyclerview. fragment1 for India and fragment2 for Australia.

In fragment1 and fragment2 can use same adapter class for both. or use separate adapter class for each fragments.

2 Answers

-1
Gopinath On

Yes, you can use same adapter class for those recycler views. Since, adapter will define the UI and bind data to it based on the arguments it pass. So you will pass different data on both the cases, it will create same UI but with diff data.
(Code Reusability).

But if you want extremely different UI in both the cases, you can opt different adapter class.

-1
Community On

ye You can use as you mention...but if you have same UI in all the fragments where you want to use same adapter.