Jetpack Compose


Reading time: less than 1 minute

Self-updating widget

@Composable  
fun Time() {  
    var dt by remember { mutableStateOf("") }  
  
    LaunchedEffect(key1 = Unit) {  
        while (true) {  
            dt = LocalDateTime.now().toString()  
            delay(500)  
        }  
    }  
  
    Text(text = dt)  
}

Citation

If you find this work useful, please cite it as:
@article{yaltirakli,
  title   = "Jetpack Compose",
  author  = "Yaltirakli, Gokberk",
  journal = "gkbrk.com",
  year    = "2024",
  url     = "https://www.gkbrk.com/jetpack-compose"
}
Not using BibTeX? Click here for more citation styles.
IEEE Citation
Gokberk Yaltirakli, "Jetpack Compose", November, 2024. [Online]. Available: https://www.gkbrk.com/jetpack-compose. [Accessed Nov. 12, 2024].
APA Style
Yaltirakli, G. (2024, November 12). Jetpack Compose. https://www.gkbrk.com/jetpack-compose
Bluebook Style
Gokberk Yaltirakli, Jetpack Compose, GKBRK.COM (Nov. 12, 2024), https://www.gkbrk.com/jetpack-compose

Comments

© 2024 Gokberk Yaltirakli