Android Question AUTO TEXT VIEW ?

LucaMs

Expert
Licensed User
Longtime User
You should use a Timer (and maybe read the documentation).

This shoud be work (I have not tested it):
B4X:
Sub Process_Globals
    Private tmrMyText As Timer : tmrMyText.Initialize("ChangeText", 10000)
End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Private lblMyText As Label
    Private mlstMyTexts As List : mlstMyTexts.Initialize
    Private mTextIdx As Int
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")
    mlstMyTexts.Initialize2(Array As String("MyText1", "MyText2", "MyText3", "MyText4", "MyText5"))
    mTextIdx = 0
End Sub

Sub Activity_Resume
    tmrMyText.Enabled = True
End Sub

Sub Activity_Pause (UserClosed As Boolean)
    tmrMyText.Enabled = False
End Sub

Sub ChangeText_Tick
    lblMyText.Text = mlstMyTexts.Get(mTextIdx)
    mTextIdx = mTextIdx + 1
    If mTextIdx > mlstMyTexts.Size - 1 Then
        mTextIdx = 0
    End If
End Sub
 
Upvote 0

ibra939

Active Member
Licensed User
Longtime User
i will tested if somebady tested upload the example test here .....Thanks for replay LucaMs
 
Upvote 0
Top