Android Question TabStrip access Events?

ilan

Expert
Licensed User
Longtime User
Hi

I see that the Tabstrip has 2 more events beside the PageSelected event that is available in b4a.

onPageScrollStateChanged
onPageScrolled

Is there any way to access them?

Thank you, ilan
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
B4X:
Dim jo As JavaObject = TabStrip1
Dim event As Object = jo.CreateEventFromUI("androidx.viewpager.widget.ViewPager.OnPageChangeListener", "PageChangeListener", Null)
jo.GetFieldJO("tabStrip").RunMethod("setOnPageChangeListener", Array(event))
End Sub

Sub PageChangeListener_Event (MethodName As String, Args() As Object) As Object
   Log("Method: " & MethodName)
   Dim ArgsList As List = Args
   Log("Args: " & ArgsList)
   Return Null
End Sub

Note that the PageSelected event will not be raised. PageChangeListener_Event will be raised instead with method = "onPageSelected"

Edit (2020): I've updated the interface class with the AndroidX class.
 
Last edited:
Upvote 0

ilan

Expert
Licensed User
Longtime User
Thank you very much erel. I will try it out. :)

EDIT: Awesome !!! exactly what i needed!! thank you
 
Last edited:
Upvote 0
Top