android语法技巧

2022-09-27  本文已影响0人  Johnson_Coding

一、定义常量用public interface constants{
String s = "xxx"
} 等效于 public static final String s = "xxx"

二、线程切换 子线程使用thradpoolManager. 主线程使用 runOnUiThread()

三、单例

kotlin
class Singleton private constructor(){
companion object {
val intance by lazy(LazyThreadSafetyMode.SYNCHRONIZED) { Singleton() }
}
}

上一篇 下一篇

猜你喜欢

热点阅读