In the function download(_: String, _: String) of PdfDownloader.kt, listener.onDownloadStart() was being invoked in the Dispatchers.IO coroutine context.
This is resulting in Exception if the observer of this callback wants to make some UI change on main thread.
Added Dispatchers.Main coroutine scope when invoking onDownloadStart() callback.
In the function
download(_: String, _: String)
ofPdfDownloader.kt
,listener.onDownloadStart()
was being invoked in theDispatchers.IO
coroutine context.This is resulting in Exception if the observer of this callback wants to make some UI change on main thread.
Added
Dispatchers.Main
coroutine scope when invokingonDownloadStart()
callback.