Given the following flow:
I want the methods to be executed by these threads:
OnClick(by system) : uiOnRefresh(1) : uiReadDb(2) : workerSetData(3) : ui
I could achieve this by making ReadDb async and awaiting 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.
