Advantages/Disadvantages of having the Adapter class as a separate class?


#1

I’ve seen many examples of RecyclerView.Adapter, some declared in the same Activity/Fragment where they are used and others where the RecyclerView.Adapter is declared as its own separate class. So what are the advantages/disadvantages of each or is it all a mater of personal preference? Many thanks.


#2

In my projects I have always defined it in its own class so that if I ever needed to use it in a different Activity or Fragment I have it ready to go. Thats the advantage I can think of. Not sure what disadvantages, if any, that might cause.