---
val viewModel = viewModel<MainViewModel>()
---
class MainViewModel : ViewModel() {
private val _data = mutableStateOf("Hello")
val data: State<String> = _data
fun changeValue() {
_data.value = "World"
}
}
Simple Example :
https://fre2-dom.tistory.com/149
Compose + MVVM
https://nanamare.tistory.com/252
728x90
'Software Development > Application Develop' 카테고리의 다른 글
Jetpack Compose - Navigation (0) | 2024.07.27 |
---|---|
Android Zetpack Compose 기초 (0) | 2024.07.27 |
Kotlin-Coroutines (0) | 2024.07.21 |
Android Sensor (0) | 2022.10.28 |
How to create walking step counter App using Accelerometer sensor and Shared Preference in Android? (0) | 2022.10.28 |