As a quick example of how to use a
Thread with a basic
Handler in an Android application, the following code creates a view where the text in the
TextView is updated to show the current date and time when the
Button is tapped.
Java source code
First, here’s the Java source code for a file class named