一、定义常量用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() }
}
}
网友评论