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
相关推荐
QianhangQianping37 分钟前
前端技术迭代深析:从 CSS 布局到状态管理的进化之路w***488238 分钟前
【MySQL】视图、用户和权限管理特级业务专家41 分钟前
写埋点、扒 SDK、改框架:JS 函数复写 10 连招实战手册感谢地心引力42 分钟前
【HTML Living Standard 01】HTML基础概述૮・ﻌ・44 分钟前
Vue2(三):自定义指令、插槽、路由沐怡旸1 小时前
【翻译】scrcpy(3.3.3)命令使用文档遇到困难睡大觉哈哈1 小时前
Harmony os 卡片传递消息给应用(message 事件)详细介绍沐怡旸1 小时前
【翻译】adb(Android Debug Bridge) 帮助文档快落的小海疼1 小时前
全局重复接口取消&重复提示