pyjnius
pyjnius copied to clipboard
Exception on Implement OnCompletionListener
Hi people i have this error sometimes when i implement the OnCompletionListener
I/python (16270): 2015-11-24 08:22:46-0600 [-] Traceback (most recent call last): I/python (16270): 2015-11-24 08:22:46-0600 [-] File "jnius_proxy.pxi", line 151, in jnius.jnius.invoke0 (jnius/jnius.c:25574) I/python (16270): 2015-11-24 08:22:46-0600 [-] File "jnius_proxy.pxi", line 121, in jnius.jnius.py_invoke0 (jnius/jnius.c:25206) I/python (16270): 2015-11-24 08:22:46-0600 [-] AttributeError: 'list' object has no attribute 'invoke' F/libc (16270): Fatal signal 11 (SIGSEGV), thread 16270 (r.vixcam:python)
This error not occur all the time, some times works well and sometimes make this exception, this is my onCompletionListener
class PythonOnComplete(PythonJavaClass):
__javainterfaces__ = ['android/media/MediaPlayer$OnCompletionListener']
def __init__(self, websocket, *args, **kwargs):
self.ws = websocket
super(PythonOnComplete, self).__init__(*args, **kwargs)
@java_method('(Landroid/media/MediaPlayer;)V')
def onCompletion(self, mp):
del self.ws.last_song
print "[PYTHON_ON_COMPLETE]" +" termino el tema"
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
Any advice?
I have the same ...
Any advice, guys?
Wrap your head around this. An overview of this approach is described here: https://github.com/Android-for-Python/Android-for-Python-Users#calling-python-from-java
Links to an example follow (it has 3 listeners, one of which is onCompletion):
Write the completion listener in Java, for example: https://github.com/Android-for-Python/Face-Detect-Example/blob/main/mlkit_src/org/kivy/mlkit/CompleteListener.java . Using the Callback wrapper described above ( for this example I used https://github.com/Android-for-Python/Face-Detect-Example/blob/main/mlkit_src/org/kivy/mlkit/CallbackWrapper.java ).
Those classes are then used in Python like this: https://github.com/Android-for-Python/Face-Detect-Example/blob/main/facedetect.py#L29-L30
https://github.com/Android-for-Python/Face-Detect-Example/blob/main/facedetect.py#L33-L49
https://github.com/Android-for-Python/Face-Detect-Example/blob/main/facedetect.py#L63-L66
https://github.com/Android-for-Python/Face-Detect-Example/blob/main/facedetect.py#L93
A Python method is thus called from a Java onCompletionListener.
👋 We use the issue tracker exclusively for bug reports and feature requests. However, this issue appears to be a support request. Please use our support channels to get help with the project. Let us know if this comment was made in error, and we'll be happy to reopen the issue.