Android Glide判断当前运行环境是否为主线程的工具方法,Kotlin
Kotlin
private fun assertMainThread() {
if (!isOnMainThread()) {
throw IllegalArgumentException("You must call this method on the main thread");
}
}
private fun isOnMainThread(): Boolean {
return Looper.myLooper() == Looper.getMainLooper()
}