美文网首页
android语法技巧

android语法技巧

作者: Johnson_Coding | 来源:发表于2022-09-27 08:37 被阅读0次

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

相关文章

网友评论

      本文标题:android语法技巧

      本文链接:https://www.haomeiwen.com/subject/wcbjgrtx.html