0

Hello friends to improve the code below; Is there a way to directly "bind" the "event.position" value without having to subscribe? Or better?

var index: BehaviorRelay<Int> = BehaviorRelay.createDefault(0)

mainViewPager.pageScrollEvents().subscribe(
        { event ->
            index.accept(event.position)
        }
    )

I think I'm looking for something like the following (This code will not work, just an example);

mainViewPager.pageScrollEvents().position.bind(index)
Felix
  • 284
  • 2
  • 12
Mehmet Ceylan
  • 385
  • 1
  • 6
  • 18

0 Answers0