Android Question Strange behavior with CallSubDelayed2 on gingerbread

ivan.tellez

Active Member
Licensed User
Longtime User
Hi, I was developping an app on KitKat, and works ok, but it required to run on Gingerbread.

Lets say there are 3 Activities, Main, acmanual, acresultados.

First, Main uses the ZXing to read a QR code and then passes the results to acmanual using CallSubDelayed.

acmanual uses an http job to validate this data with a server and gets a response. Then, this response is sent to acresultados just for showing to the user.

All of this is working great on kitkat, but then, when running on Gingerbread the app crashes with this log:



B4X:
(Intent) Intent { act=android.intent.action.MAIN flg=0x20000000 cmp=com.ioxsoft.cif.validador.plus/.main }
no extras
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **

QR_CODE:https://siat.sat.gob.mx/app/qr/faces/pages/mobile/validadorqr.jsf?D1=10&D2=1&D3=12345678900_MEE040309AX1###myzx_result
sending message to waiting queue (OnActivityResult)
running waiting messages (1)
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (acmanual) Create, isFirst = true **
** Activity (acmanual) Resume **
** Service (httputils2service) Create **
** Service (httputils2service) Start **
** Activity (acmanual) Pause, UserClosed = true **
** Activity (acresultados) Create, isFirst = true **
Error occurred on line: 41 (acmanual)
java.lang.RuntimeException: Unexpected command: 0
   at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:373)
   at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:238)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:507)
   at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:121)
   at com.ioxsoft.cif.validador.plus.acresultados.afterFirstLayout(acresultados.java:98)
   at com.ioxsoft.cif.validador.plus.acresultados.access$100(acresultados.java:16)
   at com.ioxsoft.cif.validador.plus.acresultados$WaitForLayout.run(acresultados.java:76)
   at android.os.Handler.handleCallback(Handler.java:587)
   at android.os.Handler.dispatchMessage(Handler.java:92)
   at android.os.Looper.loop(Looper.java:130)
   at android.app.ActivityThread.main(ActivityThread.java:3687)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:507)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
   at dalvik.system.NativeStart.main(Native Method)
** Activity (acresultados) Resume **
** Activity (acresultados) Pause, UserClosed = true **
sending message to waiting queue (show_resultado)





I added a breakpoint on acmanual and all works, the data is returnend from the server, CallSubDelayed2 and Activity.Finish are executed. But then, the app crashes.

The intriguing part, is that the log says:

** Activity (acresultados) Create, isFirst = true **
** Activity (acresultados) Resume **
** Activity (acresultados) Pause, UserClosed = true **

But if I put a breakpoint on Create or Resume, the code is never executed.

Code on acmanual:
B4X:
CallSubDelayed(AcResultados, "Show_Resultado")
Activity.Finish




Anyone have any Idea of why this crashes?

Thanks
 

LucaMs

Expert
Licensed User
Longtime User
While you wait for a response from Erel (to which I ask a little explanation about the "at"s of the error message - not in this particular case), try to start an empty activity, with no layout, using callsubdelayed (acEmpty, "SubX") and a log in the routine SubX.
The problem may be in the activity acresultados
 
Upvote 0

ivan.tellez

Active Member
Licensed User
Longtime User
Well, I delete all the code in the subs Create, Resume and Pause. Aldo in the Show_Resultado but I got the same error.


After a lot of wondering, i remember I was ussing the lib RSPopupMenu in my app (its API 11+) so it crashes the app by just having the Dim statement of this lib :confused:

was a little frustrating not having more information on the log.
 
Upvote 0
Top