android - 输入参数传递给 Android 中的处理程序线程
问题描述
有人可以帮我如何将输入参数传递给 Handler 线程吗?顺序如下:
启动处理程序线程
fun startBMBConnectionThread(name: String, uuid: UUID) {
// Start the thread to listen on a BluetoothServerSocket
// Create and start the Handler thread.
mBMBThread = BMBHandlerThread(name, uuid)
mBMBThread?.start()
}
处理程序线程内部类
private inner class BMBHandlerThread(inName: String, inUUID: UUID) : HandlerThread("name"){
**// I am getting error in the below 2 lines**
private val name = inName
private val uuid = inUUID
override fun onLooperPrepared() {
super.onLooperPrepared()
startBMBServerThread(name, uuid) //This will be the another Handler thread
}
// Handler will be added here
}
解决方案
推荐阅读
- javascript - 如何在 vue + ionic 上的数据属性上使用 v-for?
- python - 在python中获取控制台窗口的位置
- r - 从互联网上读取 zip 文件:open.connection(file, "rt") 中的错误:无法打开连接
- outlook - Outlook 插件命令在 Windows 桌面客户端上失败
- go - 为什么gorm order pagenate得到空结果?
- python - Python - “TypeError:'str'对象不可调用”,在构建日期格式时(来自日期时间)
- swiftui - SwiftUI .sheet 在展开可选值时意外发现 nil
- docker - Symfony 无法使用 docker 找到驱动程序
- javascript - 合并下面的正则函数和onEdit函数得到想要的结果
- java - Intellij 错误:异常构建过程终止