import org.jetbrains.anko.doAsync
import org.jetbrains.anko.uiThread
import org.jetbrains.anko.uiThread
fun anyFunction(){
doAsync {
// Normal code inside Async thread I=I+1If(I=100){ uiThread { tvResult.setText =”I is now 100!!”
}
} //More code If(x==0){uiThread { tvResult.setText =”there’s some problem!”
}
}}
}
Note: - you can include multiple uiThread inside same doAsync
- you can include multiple doAsync inside any function