https://kotlinlang.org logo
#android
Title
# android
r

r-z

08/20/2017, 7:31 PM
I've got an async thread thing here and it stops prematurely without giving any errors if I edit the UI with it, any ideas what could be the cause? I'm not getting any errors
stackoverflow 2
k

kingsley

08/20/2017, 9:46 PM
Well. Modifying UI element from a non UI thread throws a
called from wrong thread exception
, and the coroutine in async terminates immediately. And with
async
, the error will only propagate if you use the result of the coroutine (via
await
and co) To solve this, you need to make sure your UI is modified only from the UI thread.
There’s a #coroutines channel for coroutine related questions mind you. And of course, you can always put this on Stackoverflow 🙂
r

r-z

08/21/2017, 3:19 PM
Took me far longer to figure what you just said than I dare to admit. Got the thing to work, this is awesome, you are awesome
k

kingsley

08/21/2017, 3:54 PM
Haha. You’re welcome 🙂
2 Views