Android Question Refresh a Label

Peter Lewis

Active Member
Licensed User
Longtime User
Hi

I have been trying for hours and searching all over the place for a solution for this problem.

I have 8 labels on the screen that I want to flash randomly on the screen and then stop on one of them. The problem is the screen does not refresh so I cannot see the flashes. All I see is the end result.

In other languages that I have used , I can either refresh the Object / Field after updating it or refresh the whole screen.

If you have any ideas how I could refresh the screen I would appreciate it. I only started programming with this language today even though I have purchased it over 3 years ago and also paid for the update.

Thank you in advance
 

Peter Lewis

Active Member
Licensed User
Longtime User
B4X:
Label1.Invalidate

But if you are trying to flash the labels within the same sub/event in a loop, you may need to add DoEvents.

Or cycle the labels in a timer instead.

I did try Label1.Invalidate but it did not work. Thank you for steering me in the right direction I will keep trying

I tried a for-next look and also a Delay sub
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
DoEvents may also be needed!
 
Upvote 0

Peter Lewis

Active Member
Licensed User
Longtime User
As MichBu already suggested you should use a Timer.
How do you access the Labels, do you use an array of Labels?

I am going to put the labels into an array and then use a RNG to choose one at a time and flash it. I am also going to make the first 2 second flash fast between them and then slow it down until it stops at the last one.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…