![]() |
VOOZH | about |
Text Clock is a UI widget in android which is used to display the current time in android applications. This widget displays the current time in a simple text view. The text clock widget displays a time in 12 and 24 hours format. In this article, we will take a look at How to use the TextClock widget on android using Jetpack Compose.
To create a new project in the Android Studio, please refer to How to Create a new Project in Android Studio with Jetpack Compose.
Go to the MainActivity.kt file and refer to the following code. Comments are added inside the code to understand the code in more detail.
In this file, we will be using the AndroidView composable to integrate the xml view, TextClock in compose.
MainActivity,kt: