Android Example [B4X] AS ViewPager - Auto Play

In this example project you can see how to add an auto play feautre to the AS ViewPager.
B4X:
Sub Class_Globals
    Private tmr_AutoPlay As Timer
End Sub

Private Sub B4XPage_Created (Root1 As B4XView)
    tmr_AutoPlay.Initialize("tmr_AutoPlay",2000)'2 seconds
    tmr_AutoPlay.Enabled = True
End Sub

Private Sub tmr_AutoPlay_Tick
    If ASViewPager1.CurrentIndex = ASViewPager1.Size -1 Then
        ASViewPager1.CurrentIndex2 = 0
    Else
        ASViewPager1.NextPage
    End If
End Sub
 

Attachments

  • AS ViewPager Auto Play.zip
    10.2 KB · Views: 152
Last edited:
Top