fun getPrivateValue(device: BluetoothDevice?):Int{
try {
val activityManagerClass =
Class.forName("android.bluetooth.BluetoothDevice")//类名
val getCurrentUserMethod =
activityManagerClass.getMethod("getAdapterIndex")//方法
return getCurrentUserMethod.invoke(device) as Int
}catch (e: Exception){
LogUtils.d(TAG,"error")
}
return -1
}
Android 反射
阿道夫小狮子2025-12-02 11:27
相关推荐
Le_ee5 小时前
SWPUCTF 2025 秋季新生赛wp2前端之虎陈随易5 小时前
为什么今天还会有新语言?MoonBit 想解决什么问题?kyriewen5 小时前
你等的Babel编译,够喝三杯咖啡了——用Rust重写的SWC,只需眨个眼搬砖码5 小时前
同源多标签页通信 4 种方案,从入门到生产环境张元清5 小时前
SSR 状态管理陷阱:defineStore vs defineContextStoredonecoding6 小时前
nrm、corepack、npm registry 三者的爱恨情仇小gaigagi6 小时前
从吉客云·奇门到MySQL的完整数据流悟空瞎说6 小时前
用 Rust 开发 QML 桌面应用(第二篇)—— 日志系统完整搭建LIO6 小时前
前端开发之Git 代码仓库管理详细教程软件开发技术深度爱好者6 小时前
前端网页开发三剑客快速入门