Android Question Flash text

SoyEli

Active Member
Licensed User
Longtime User
Hello,

Is it possible to flash (show) some text on a label ?
I tried " Label.bringtofront then sleep(0) then Label.sendback but it doesn't work.

example: Person must be able to see the text then gradually the flash rate increases until it can't be seen anymore.

If so, how?

Thank you;
 

SoyEli

Active Member
Licensed User
Longtime User
With this, I can only alternate flash about 1 second,
Without the "sleep(0)" it will not show at all.

FlashTimer.Initialize("FlashTimer",1000)
...
Sub Flashtimer_tick
LabelFlash.BringToFront
Log("Flash On")
Sleep(0)
LabelFlash.SendToBack
Log("Flash Off")
End Sub


Any ideas?
 
Upvote 0

SoyEli

Active Member
Licensed User
Longtime User
Sorry, I guess I didn't properly explain,
I need to control how long the text is visible, Not how fast it flashes.
Example: Label.visible for 1 millisecond (.001) to 1 second (1).

Thank you,
 
Upvote 0

Computersmith64

Well-Known Member
Licensed User
Longtime User
Sorry, I guess I didn't properly explain,
I need to control how long the text is visible, Not how fast it flashes.
Example: Label.visible for 1 millisecond (.001) to 1 second (1).

Thank you,

If you use the Flashtimer_tick code that Brandsum posted & set your FlashTimer interval to whatever you want, it will flash on/off for that duration. The other option would be:

B4X:
flashLabel(500) 'show label for 500ms

Private Sub flashLabel(duration as Int)

    LabelFlash.Visible = True
    Log("Flash On")
    Sleep(duration)
    LabelFlash.Visible = False
    Log("Flash Off")

End Sub

- Colin.
 
Upvote 0

SoyEli

Active Member
Licensed User
Longtime User
Refer to post #4

I tried 500, 100, 10, 1, 0, .01 etc.

with sleep(0) or less the view (visible) duration is about 500 milliseconds

I need to control the view length.

Thank you, I appreciate you trying to help.
 
Upvote 0

Computersmith64

Well-Known Member
Licensed User
Longtime User
Refer to post #4

I tried 500, 100, 10, 1, 0, .01 etc.

with sleep(0) or less the view (visible) duration is about 500 milliseconds

I need to control the view length.

Thank you, I appreciate you trying to help.
Not sure if you're replying to me or not - but if you are, then you clearly didn't try the code I posted.

- Colin.
 
Upvote 0

SoyEli

Active Member
Licensed User
Longtime User
I did try it, all the way down to FlashLabel(1) = 1 millisecond.
Should I be able to see a text being flashed at me for (1 millisecond) ???
I need to flash the text fast enough , NOT to be able to see.
Maybe, if there's a way to flash the text less then 1 millisecond?

Thank you,
I appreciate your help,
 
Upvote 0

Computersmith64

Well-Known Member
Licensed User
Longtime User
I did try it, all the way down to FlashLabel(1) = 1 millisecond.
Should I be able to see a text being flashed at me for (1 millisecond) ???
I need to flash the text fast enough , NOT to be able to see.
Maybe, if there's a way to flash the text less then 1 millisecond?

Thank you,
I appreciate your help,
Yes - I tried it down to 1ms & could still see it. I guess the time that it takes to make the label visible & then invisible again is more than that. Maybe a stupid question, but why do you want to flash the label if the objective is for someone not to see it? Why not just make it invisible?

- Colin.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
There is no such thing in Android like showing an UI-Element for 1 Millisecond. And also not for less then 1ms.
You should expect your Device is doing something other. Or your activity can be paused.
 
Last edited:
Upvote 0

Computersmith64

Well-Known Member
Licensed User
Longtime User
There is no such thing in Android like showing an UI-Element for 1 Millisecond. And also not for less then 1ms.
I suspect it's a limitation of the hardware not being able to process the requests fast enough. In theory, if you had an Android "super device" capable of drawing the screen at 1000+ frames per second it could be done. :)

- Colin.
 
Upvote 0
Top