peacemaker Expert Licensed User Longtime User Oct 27, 2016 #1 Seems, the lib sample is not working in B4A 6.3... :-( C:\Program Files\Java\jdk1.8.0_77\bin\javac.exe - Java 8 Update 91 - is it important ? A new thread is started, but ended with the error: error=Exception : wrong number of arguments; expected 4, got 0 Errors, if Code: Copy Dim args(4) As Object error=Exception : argument 1 should have type java.lang.String, got java.lang.Object error=Exception : argument 2 should have type java.lang.String, got java.lang.Object error=Exception : argument 3 should have type java.lang.Object[], got java.lang.Object This: Code: Copy Dim args(4) As Object args(0) = "" args(1) = "" Dim args2(0) As Object args(2) = args2 Log(thread1.Start(Me, "Th_read", args)) gives in Code: Copy Sub Thread1_Ended(fail As Boolean, error As String) 'An error or Exception has occurred in the Thread Log("fail=" & fail) ' gives FALSE !!! Log("error=" & error) ', but next ERROR: End Sub Code: Copy ** Service (starter) Create ** ** Service (starter) Start ** Unexpected event (missing RaiseSynchronousEvents): Check the unfiltered logs for the full stack trace. java.lang.RuntimeException: java.io.EOFException at anywheresoftware.b4a.shell.Shell$2.run(Shell.java:313) at android.os.Handler.handleCallback(Handler.java:725) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5041) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) at dalvik.system.NativeStart.main(Native Method) Caused by: java.io.EOFException at java.io.DataInputStream.readByte(DataInputStream.java:98) at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:333) at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:247) at anywheresoftware.b4a.shell.Shell$2.run(Shell.java:311) ... 9 more Heeeelp ! Last edited: Oct 27, 2016
Seems, the lib sample is not working in B4A 6.3... :-( C:\Program Files\Java\jdk1.8.0_77\bin\javac.exe - Java 8 Update 91 - is it important ? A new thread is started, but ended with the error: error=Exception : wrong number of arguments; expected 4, got 0 Errors, if Code: Copy Dim args(4) As Object error=Exception : argument 1 should have type java.lang.String, got java.lang.Object error=Exception : argument 2 should have type java.lang.String, got java.lang.Object error=Exception : argument 3 should have type java.lang.Object[], got java.lang.Object This: Code: Copy Dim args(4) As Object args(0) = "" args(1) = "" Dim args2(0) As Object args(2) = args2 Log(thread1.Start(Me, "Th_read", args)) gives in Code: Copy Sub Thread1_Ended(fail As Boolean, error As String) 'An error or Exception has occurred in the Thread Log("fail=" & fail) ' gives FALSE !!! Log("error=" & error) ', but next ERROR: End Sub Code: Copy ** Service (starter) Create ** ** Service (starter) Start ** Unexpected event (missing RaiseSynchronousEvents): Check the unfiltered logs for the full stack trace. java.lang.RuntimeException: java.io.EOFException at anywheresoftware.b4a.shell.Shell$2.run(Shell.java:313) at android.os.Handler.handleCallback(Handler.java:725) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5041) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) at dalvik.system.NativeStart.main(Native Method) Caused by: java.io.EOFException at java.io.DataInputStream.readByte(DataInputStream.java:98) at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:333) at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:247) at anywheresoftware.b4a.shell.Shell$2.run(Shell.java:311) ... 9 more Heeeelp !
Erel B4X founder Staff member Licensed User Longtime User Oct 27, 2016 #2 It is not related to the B4A version of to Java version. The Threading library will not work in debug mode. Upvote 0
It is not related to the B4A version of to Java version. The Threading library will not work in debug mode.
peacemaker Expert Licensed User Longtime User Oct 27, 2016 #3 If in release mode - sometimes the error returned from the new thread: error=Exception : Can't create handler inside thread that has not called Looper.prepare() UPD: now this error is always ((( If to start the sub as usual in the main thread - no problem, but slow, it needs background running Last edited: Oct 27, 2016 Upvote 0
If in release mode - sometimes the error returned from the new thread: error=Exception : Can't create handler inside thread that has not called Looper.prepare() UPD: now this error is always ((( If to start the sub as usual in the main thread - no problem, but slow, it needs background running
Erel B4X founder Staff member Licensed User Longtime User Oct 30, 2016 #4 Avoid using the Threading library. What do you need it for? Upvote 0
peacemaker Expert Licensed User Longtime User Oct 30, 2016 #5 Actually, this long loop sub is OK now, if to remove all DOEVENTS. But anyway, it would be good to understand the rules how to use subs structure in another thread. If it's another sub that uses another subs, with parameters... and how to get the result back correctly... Upvote 0
Actually, this long loop sub is OK now, if to remove all DOEVENTS. But anyway, it would be good to understand the rules how to use subs structure in another thread. If it's another sub that uses another subs, with parameters... and how to get the result back correctly...