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
相关推荐
IT_陈寒2 分钟前
Redis的DEL命令竟然没删掉数据?我踩的这个坑你得知道anOnion3 分钟前
构建无障碍组件之Menu and Menubar PatternJavaGuide10 分钟前
我用 Claude Code/ZCode+GLM-5.3 从零做了一款 Agent 游戏!Eason_Lou15 分钟前
vue flow使用注意事项JJJennie77723 分钟前
Gemini 3.7 Flash 上线,Google 想让 AI 多干活启雀AI31 分钟前
培训平台移动端离线学习方案设计与实现:视频缓存、断点续传与进度同步的工程实践小赵同学WoW1 小时前
1-2 TypeScript 中的 `any` 与 `unknown`six_1 小时前
C# 上位机(持续更新中)风雨_1 小时前
Git Worktree sourcetree完整使用指南半个落月2 小时前
React 组件通信进阶:useContext 与自定义 Hook 实战详解