在 API 级别 28(Pie)上,引入了一种新方法Context
获取主线程执行器的类getMainExecutor() https://developer.android.com/reference/android/content/Context#getMainExecutor().
如何在 API 级别低于 28 的情况下获取此执行器?
您可以使用(例如在活动中):
ContextCompat.getMainExecutor(this);
https://developer.android.com/reference/androidx/core/content/ContextCompat.html#getMainExecutor(android.content.Context) https://developer.android.com/reference/androidx/core/content/ContextCompat.html#getMainExecutor(android.content.Context)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)