Android Question Event in other module

Victor Pavlov

Member
Licensed User
Longtime User
I have some stupid mistake in my code and cannot find it, so any suggestion is welcome. I initialize class, than make a copy of it. In the copy I use Socket and ASyncStreams. The problem is that the Event "NewData" arrives in Main module. In Debug it shows that the ASyncStreams is part of the class. The Write method is working fine in the class module. Any idea?
 

Victor Pavlov

Member
Licensed User
Longtime User
Additional information. One of three starts, the function works OK in Debugger mode and no successful start in Release mode yet.
 
Upvote 0

Victor Pavlov

Member
Licensed User
Longtime User
B4X:
    'Configure Active Printer
    Dim oPrinter As Object = CallSub(initPrinter.ref, "getPrinter_Instance")'MakeNewPrinterInstance(printer)
    CallSub2(oPrinter,"setSelected_Printer", printer.id)
    CallSub2(oPrinter,"SetConnection_Parameters", printer.connectionParams)
    printer.driver = oPrinter
    
    'Add to Active Printers
    ActivePrinters.Add(printer)

B4X:
'Copy current object
Public Sub getPrinter_Instance As PrinterDatecs
    Dim objectCopy As PrinterDatecs
    objectCopy.Initialize(masterPrinter, IDPrefix)
    Return objectCopy
End Sub
 
Upvote 0

Victor Pavlov

Member
Licensed User
Longtime User
How do you make a copy of a class instance?

AsyncStreams events will be raised in the module that initialized the object.

java.lang.Exception: Sub devicestream_newdata was not found.
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:197)
at anywheresoftware.b4a.BA$2.run(BA.java:365)
at android.os.Handler.handleCallback(Handler.java:836)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:203)
at android.app.ActivityThread.main(ActivityThread.java:6247)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)

The same code, run under Debug and stopped for 2-3 sec in some subs, works perfectly.
 
Upvote 0
Top