3

I'm implementing my own app using Hilt. However I ran into a problem when trying to inject a FragmentStateAdapter. It created a cycle dependency. How can I solve this? Here's my code:

@AndroidEntryPoint
class MainActivity : AppCompatActivity() {

private val screensViewPagerAdapter = 
      ScreensViewPagerAdapter(this)
... 
}

FragmentStateAdapter class

class ScreensViewPagerAdapter @Inject 
     constructor(@ActivityContext context: Context) : 
      FragmentStateAdapter(context as AppCompatActivity) {
...
}
Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
avillagomez
  • 443
  • 1
  • 8
  • 18
  • Found solution here https://stackoverflow.com/questions/62850811/dagger-with-hilt-inject-activitycontext-in-adapter-from-module# – avillagomez Sep 24 '20 at 00:59

0 Answers0