Android:扩展通过反射获得的隐藏类 [英] Android: Extending a hidden class that is obtained through reflection

查看:351
本文介绍了Android:扩展通过反射获得的隐藏类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何扩展只能通过反射访问的类?

How can I extend a class that is only accessible through reflection?

基本上,我正在尝试扩展在Galaxy S3中找到的com.samsung.bluetoothle.BluetoothLEClientProfile类,以使其能够与我的蓝牙LE设备进行通信.该类是隐藏的,我需要扩展它.

Basically, I am trying to extend the com.samsung.bluetoothle.BluetoothLEClientProfile class that is found in the Galaxy S3 to enable communication it with my bluetooth LE device. The class is hidden and I need to extend it.

推荐答案

在项目的正确包(com.samsung.bluetoothle)中添加一个虚拟类,然后对其进行扩展.在运行时,系统类将被加载,您应该获得所需的行为.

Add a dummy class in the right package (com.samsung.bluetoothle) in your project, then extend it. At runtime the system class will be loaded, and you should get the desired behaviour.

这篇关于Android:扩展通过反射获得的隐藏类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆