I have two tabs in which I add two different lists of data, both tabs share a single recyclerview, so at my viewpager adapter, I just create a new instance to populate the d
viewPagerAdapter.productsList = productsList
viewPagerAdapter.drinksList = drinksList
viewPagerAdapter.notifyDataSetChanged()
If i didn't understand wrong when you came here your viewPagerAdapter already created and you defined your lists as nonNull in adapter( MutableList< Product >).
fun getItem(position: Int):Product{
return productList[position]
}
For example this block tries to get position 1 when adapter is created and before you set data. It gonna return IndexOutOfBoundsException.
Maybe you must try to move this lists in viewPagerAdapter's constructor.