You can try using a CoroutineScope, on the io thread (remember that io does not handle the interface so you will have to use a with context on the Main thread to paint something on it).