Android Question Label SetVisibleAnimated

Hi there,

So all I want here is a button. It should display Hello when odd number of clicks and nothing when even number of clicks.

B4X:
Sub Globals
    Dim Label1 As Label
    Dim Button1 As Button
    Dim click As Int = 0
End Sub

Sub Button1_Click
    click = click + 1
   
    If click = 2 Then
        Label1.SetVisibleAnimated("1000", False)
        click = 0
    Else
        Label1.Text = "Hello"
        Label1.Visible = True
    End If
   
End Sub

This program runs fine for the first two clicks. i.e.
1st click - Displays Hello
2nd click - Hides Hello
3rd click - Goes in the Else part (which is correct) but even after executing
Label1.Text = "Hello" and Label1.Visible = True, it doesn't display Hello.

I am just curious if I need to do something after using SetVisibleAnimated?

Thank you
 

Gary Milne

Active Member
Licensed User
Longtime User

Don't know if you resolved this but you could use my SmartHost class to do this type of animated toggle. This tutorial has a bunch of examples some of which include animation effects.

https://www.b4x.com/android/forum/t...toggle-buttons-and-check-boxes.62427/#content
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…