Android: Extending a hidden class that is obtained

2019-04-15 03:11发布

问题:

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

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.

回答1:

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.