May I use PyJNIus objects in threads?

64 views
Skip to first unread message

Dewald du Plooy

unread,
Apr 9, 2014, 11:17:20 AM4/9/14
to pyjni...@googlegroups.com
Hi,

The following kivy program crashes on my android device when the thread exists. Am I doing something wrong? May I use Pyjnius in threads?

PyJNIus version is 1.1-dev. I've attached the relevant part of output of adb logcat.


from kivy.uix.button import Button
from kivy.app import App
from kivy.logger import Logger

import threading

import jnius
from jnius import autoclass

def threadFunc():

    System = autoclass('java.lang.System')    
    System.out.println('Hello World')
    Logger.info('running thread')

if __name__ == '__main__':

    class KivyApp(App):

        def on_start(self):
            print "PyJNIus version: " + jnius.__version__
            self.t = threading.Thread(target=threadFunc)
            self.t.start()
            
        def build(self):
            return Button(text='Hello World')                       

    KivyApp().run()


Best Regards,
Dewald
adb_logcat.txt
Reply all
Reply to author
Forward
0 new messages