Closed keramat-farid closed 11 months ago
Adapters hold the reference for all items them self, you don't need to declare a variable to save their references. If you want to prevent extra fragments creation you can use setOffscreenPageLimit
setOffscreenPageLimit
https://github.com/farbodbj/GuardianNews/blob/47fa4e005c8bd70f028b2b5218d904e96c77d8b6/app/src/main/java/com/bale_bootcamp/guardiannews/adapter/NewsPagerAdapter.kt#L13
fragments list removed. fragment instances are now made using a factory class and DI.
Adapters hold the reference for all items them self, you don't need to declare a variable to save their references. If you want to prevent extra fragments creation you can use
setOffscreenPageLimit
https://github.com/farbodbj/GuardianNews/blob/47fa4e005c8bd70f028b2b5218d904e96c77d8b6/app/src/main/java/com/bale_bootcamp/guardiannews/adapter/NewsPagerAdapter.kt#L13