Android Question Abnormal termination

rossati

Active Member
Licensed User
Longtime User
Hello
I have an abnormal termination when call a sub by CallSubDelayed2. Unfortunately I have a generic error and not where the problem arises.
The call is from two modules.
This is, my be, a sync problem as if i insert an Msgbox after CallSubDelayed2 the app works as I expect.
Any idea?
 

rossati

Active Member
Licensed User
Longtime User
Yes:
L'applicazione Solaire si è bloccata in modo anomalo
(The Solaire application crashed abnormally)
 
Upvote 0

rossati

Active Member
Licensed User
Longtime User
I apologize the emulator don't start for lacks of hardware accellerator.
My be I have not understand: can I install the app by cable connection?
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
can I install the app by cable connection?
Yes.

Enable USB Debugging in the Device, install the Device driver on your PC.

If you connect your device using USB then you should be able to install the app through this cable-connection when you click on Compile (or using F5 to compile).
 
Upvote 0

rossati

Active Member
Licensed User
Longtime User
Thanks,
B4a Version 6.31; in debug mode after CallSubDelayed2 there is a End sub and after this crashes.
I apologize Where i can find the device drivers?
 
Upvote 0

rossati

Active Member
Licensed User
Longtime User
Thanks to you now I know some tools and understood some things.
here the log:
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = true **
Installing file.
PackageAdded: package:condor.solair
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
findCamera
null
2
facing: 0, 0
** Activity (main) Resume **
findCamera
0
2
facing: 0, 0
90
findCamera
null
2
facing: 0, 0
findCamera
0
2
facing: 0, 0
90
java.lang.RuntimeException: java.lang.NoSuchFieldException: processBA
at anywheresoftware.b4a.keywords.Common$5.run(Common.java:999)
at anywheresoftware.b4a.keywords.Common$6.run(Common.java:1010)
at android.os.Handler.handleCallback(Handler.java:800)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5371)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NoSuchFieldException: processBA
at java.lang.Class.getField(Class.java:787)
at anywheresoftware.b4a.keywords.Common.getComponentBA(Common.java:1037)
at anywheresoftware.b4a.keywords.Common$5.run(Common.java:944)
... 10 more
 
Upvote 0

rossati

Active Member
Licensed User
Longtime User
Hello
B4X:
CallSubDelayed2(fh_returnSub(0),fh_returnSub(1),Data)
after the program executes an END SUB and crashes.
Module and sub are correct. my be the problem arises because Module is a class module? I.e. can I call a sub on class module from a class module?
 
Upvote 0

rossati

Active Member
Licensed User
Longtime User
Thanks
In my case from a class "Photo" I call a class "formgen" indicating to return (by callSubDelayed) to a sub on Photo class.
 
Upvote 0

rossati

Active Member
Licensed User
Longtime User
I attach a very basic app that crashes, I think the problem is a call from class to class.
 

Attachments

  • OOCall.zip
    9.6 KB · Views: 169
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
You are calling:
B4X:
CallSubDelayed2("Photo",fh_returnSub(1),Data)
This cannot work as Photo is a class. You need to pass a class instance.

Correct code:
B4X:
Sub Class_Globals
   Private mCallback As Object
   Private mEventName As String
   Private act As Activity
   Private fh_panel As ScrollView   ' Reference to panel handle
   Private Data As Map
End Sub

Public Sub Initialize
   Data = CreateMap("fh_button":"Ok")
End Sub
Sub fg(activ As Activity,params As String,Callback As Object, EventName As String)
   mCallback = Callback
   mEventName = EventName
   act = activ
   fh_panel.Initialize(100%y)
   fh_panel.Color = Colors.Cyan
   Dim btn As Button
   btn.Initialize("btn")
   btn.text = "Ok"
   fh_panel.Panel.AddView(btn,100,100,90 , 60)
   act.AddView(fh_panel,0,0,100%x,100%y)
End Sub

Sub btn_Click
   CallSubDelayed2(mCallback, mEventName ,Data)
End Sub

Call fg with:
B4X:
fg.fg(act,cameraParams, Me,"handleCameraParams")


Tip:
1. Avoid using strings as targets.
2. Don't concatenate two values and then parse the string. Pass them as two different parameters.
3. There are many warnings. You should fix them.
 
Upvote 0
Top