Sketchware: How to create a digital clock?

It is very easy to include a real time digital clock in your Android App created with Sketchware.

Firstly, drag and drop a textview widget in a linear layout. Edit it's text size to 25 or more.

Now in the Logic of your app, add a Calendar component and a Timer component.


Then go to onCreate event and add a new block. I added a block named rep in my project.


After that define the new block function. Use TimerTask after ..1.. ms block and inside that use Calendar getNow block and textview setText block. Set text of textview to Calendar...Format.... block, and then repeat the block. The image below shows the blocks.


Lastly, in onCreate activity drag and drop the new block as shown below.
Now save and run your app. It will show current date and time updating every millisecond.

You can change the calendar Format to show the clock in your way. The format 'yyyy-MM-dd hh:mm:ss a' will show the time in AM/PM format.

Komentar

Cara pembuatan Apps paling Populer

Create Stopwatch App in Android using Sketchware

TextInputLayout in Sketchware

How to find and​ highlight a word in a text field in Sketchware?

A Flash Light App in Sketchware

How to enable download in webview in Sketchware apps?

Intent - Open File By Type

Code for implementing Notifications in Sketchware

How to share an image from Drawable folder?

ActionBar back button

Animation Transtition Animation