Android Question TabStrip access Events?

Discussion in 'Android Questions' started by ilan, Jun 20, 2017.

  1. ilan

    ilan Expert Licensed 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
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Code:
    Dim jo As JavaObject = TabStrip1
    Dim event As Object = jo.CreateEventFromUI("android.support.v4.view.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"
     
    Peter Simpson and ilan like this.
  3. ilan

    ilan Expert Licensed User

    Thank you very much erel. I will try it out. :)

    EDIT: Awesome !!! exactly what i needed!! thank you
     
    Last edited: Jun 20, 2017
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice