@Query("DELETE FROM tableName")
suspend fun resetData()
fun startAllDataReset() = viewModelScope.launch(Dispatchers.IO) {
dao.resetData()
}
I initially deleted it as a delete query, but this method also stopped the ui.
fun startAllDataReset() = viewModelScope.launch(Dispatchers.IO) {
database.clearAllTables()
}
The second time I tried this method also stops the ui.
It stops for about 20 seconds, and then the ui starts working again, and I don’t understand this part. Even if it worked on ui thread, there is less than 10 data on my table, and there seems to be no reason to operate for this long.