In lack of code I only can assume you like to get a list of X number from Api or database, etc and you only want to show max of 6 items
it would have been easier to see some code of what you have done so-far so the correction/suggestion will suite you better, in lack of code I give you few suggestions:
your view should not know anything on how to handle data , it should simply show the data , in you case it should receive a 6 items and show them in the view (recyclerView in your case).
I assume you are not using any pattern (like MVVM or MVP) and you just obtaining your list from (api or database) inside your Activity - (extra tip -> it is always better to use sort of Architecture design to separate your logic into a Presenter / viewModel layer for easy unit test purposes later)
lets assume you define your Adapter in Activity and passing your list like:
In your activity
var listOfAllYourItems = arrayListOf(object1,object2,...,object100)
val myAdapter = MyAdapter()
myAdapter.setItems(listOfAllYourItems.sublist(1,6)) //this will only pass the first 6 items
the rest of normal stuff ...
so this is like you have only 6 items and displaying it in recyclerView - simple (view does not hold any logic on how to handle items over 6 etc, view just know how to display item and should not care on how to handle anything else)
Extra point :
you can add a next / previous button in your view (perhaps below you RecyclerView in you activity xml), and then you add some logic to them to show next 6 items from list onNextTapped or previous 6 items when tapped previous button like :
In your activity
fun noNextTapped(){
myAdapter.setItems(listOfYour6Items.sublist(6,12))
//of course you need to add your logic to handle edge cases like what if the list size does not have enough items (like if it is only have 10 items) etc , and some other logic on how to know which page you are displaying so you can pass the correct number of items to the adapter onNextTapped fun (each page shows 6 items) I leave those to you
}
in your MyAdapter :
class MyAdapter : RecyclerView.Adapter<RecyclerView.ViewHolder> {
var list List<Objects> ;
fun setItems(new6Items : List<Objects>){
list.clear()
list.addAll(new6Items)
notifyDataSetChanged()
}
...
}