class SecondViewModel : ViewModel() {
fun threadTest() {
SimpleThread1().start()
}
fun test() = viewModelScope.launch {
for(i in 0..10) {
Log.d("TEST", i.toString())
delay(1000)
}
}
}
class SimpleThread1 : Thread() {
override fun run() {
for(i in 0..10) {
Log.d("TEST", i.toString())
sleep(1000)
}
}
}
'Android Jetpack' 카테고리의 다른 글
ViewModelScope (0) | 2022.04.13 |
---|---|
Retrofit이란? (0) | 2022.04.12 |
Coroutine Simple Example (0) | 2022.04.11 |
What is Coroutine? (0) | 2022.04.10 |
Android LiveData - 6 (ViewModel + LiveData + DataBinding) (0) | 2022.04.03 |