android - How to get Executor for main thread on API level < 28
问题描述
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);
推荐阅读
- react-native - 通过单击按钮反应本机控件选项卡导航
- c# - 使用数据库优先方法的 WPF 中的 DataAnnotation - 如何将数据注释移动到伙伴类,包括。IsValid 函数
- r - 如何在r中从长到宽传播不平衡数据
- mongodb - 从嵌入式 Mongo 文档中以字符串形式获取数据
- java - 运行Junit测试时如何修复assertTrue错误
- angular - 如何自定义 Compodoc Angular 文档?
- jquery - 如何避免 .each 方法中的重复值
- php - 如何在 HMVC Codeigniter 中获取模块名称
- json - 如何将特定 DBpedia (SPARQL) 导出为 JSON 以用于 openlayers 地图?
- android - webkit 未定义:InAppBrowser Cordova