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
 
Code:
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

Similar Threads

  • Question Question
Android Question Fix TabStrip tabs
Replies
1
Views
2K
Replies
5
Views
5K
Replies
8
Views
8K
Back
Top