On API level 28(Pie) a new method is introduced in the Context class to get Executor for the main thread getMainExecutor().
How to get this executor on API level below 28?
You can use (in activity for example):
ContextCompat.getMainExecutor(this);
https://developer.android.com/reference/androidx/core/content/ContextCompat.html#getMainExecutor(android.content.Context)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With