Is it okay a presenter having Android Handler?
I know presenters should not have any Android related objects,
but I really don't have any clear answer.
Here's the thing, this presenter runs a disk IO task on another thread, meanwhile, the activity has to change its view.
These jobs are supposed to be done concurrently. So I decided to pass the activity's handler as an argument and let presenter send message to activity like this:
class FooPresenter: FooContract.Presenter {
…
private fun doDiskIOTask(handler: Handler) {
handler.sendEmptyMessage(0)
do_something_on_new_thread_and_join()
handler.sendEmptyMessage(1)
}
…
}
The activity has to know when the task is started and finished both and change view. Could you tell me if I'm doing it any wrong or the better way?