Given the following flow:

[![](https://i.stack.imgur.com/sOBLT.jpg)](https://i.stack.imgur.com/sOBLT.jpg)

I want the methods to be executed by these threads:

* `OnClick` (by system) : ui
* `OnRefresh` (1) : ui
* `ReadDb` (2) : worker
* `SetData`(3) : ui

I could achieve this by making `ReadDb` *async* and *await*ing it, but it would freeze the UI thread.

Can you think of an approach that doesn't involve implementing `Interactors`, `AsyncTask` etc. ?

Thanks.

---

**Edit**

I am looking for an elegant solution, please avoid having wrappers like `new Handler (Looper.getMainLooper()).post(...)`, `RunOnUiThread` in every method of the `View` etc. 

The easiest approach is to use `taskt` and `await`:

```
async OnRefresh() {
    data = await m.ReadDb() 
    v.SetData(data)
}

```

However, the UI freezes on `await m.ReadDb()`. I thought that because `OnRefresh` returns `void` it would go back and finish executing the parent method (`OnClick`). Then, once the `await` is done, it would exeute `v.SetData(d)`. For some reason, it's not the output I am getting.