Display Live Time on Label

Hi, I want to display live device time on a label and it should refresh every second, how can I achieve that?

What have you tried?

I have tried a while loop to test label1.text in label with clock.now time and add a second to the label time but it does not work.


I think the test condition is not working

Use a clock sensor with

image

And use these blocks

image

2 Likes

Yeah, it works perfectly, Thanks @Peter for great help, I was trying to get around for 3 hours.

One little problem, now when I click on 'Designer', it switched and instantly comes back in blocks mode. Why is this happening?

That's one more reason to ask questions here earlier. I think it took Peter less than 3 seconds to know how to do it. :wink:

Not clear. Please explain ...

Here is the video of the problem, when code block is not active, designer mode works fine, but when I put the code block back in event procedure, app designer mode is coming back to block mode.

Yes, this is indeed strange behavior. Connect to Companion and try again. It shouldn't happen then.

Could it be a desktop mechanical issue, like corner of keyboard resting on a trackball button?
(Has happened to me)

Nah, it didn't change since I have changed the emulator and even though I have connected android device, the issue persists. In fact, I am workig on my app by placing the code block outside even procedure so I can work on other design components.