我正在尝试实现 android.bluetooth.le.ScanCallback,这是一个使用 pyjnius 的抽象类。在我实例化下面给出的 python 类的那一刻,有一个 JVM 错误。该错误表明 android.bluetooth.le.ScanCallback 不是接口类。我相信接口是一个抽象类。我错过了什么?
class ScanCallback(PythonJavaClass):
__javainterfaces__ = ['android/bluetooth/le/ScanCallback']
def __init__(self, scanCallback, batchCallback=None, errorCallback=None):
super(ScanCallback, self).__init__()
self.batchCallbk = batchCallback
self.scanCallbk = scanCallback
self.errorCallbk = errorCallback
pass
@java_method ('(L/java/utils/List<ScanResult>/)V')
def onBatchScanResults(self,results):
print dir(results)
@java_method ('(I)V')
def onScanFailed(self, errorCode):
print "failed to scan" + str(errorCode)
raise ValueError(str(errorCode))
@java_method ('(IL/android/bluetooth/le/ScanResult)V')
def onScanResult(self, callbackType, result):
print dir(result)