I have an Android service that starts and maintains a background thread.
From time to time, the background thread needs to do a callback on the main thread. I\'m stu
If you code in Kotlin you can use coroutine with Main dispatcher:
private fun runOnUiThread(block: () -> Unit) { CoroutineScope(Dispatchers.Main).launch { block.invoke() } }
Of-cause coroutines should added to your project as a dependency.