Android Question tag property lost value in jobdone sub

miguelconde

Member
Licensed User
Longtime User
Hello Erel and guys.

I am using the OkHttp and OkHttpUtils2.

I have a problem when i try to pass a Object (Me)
through the Job TAG property. I am indicating the (Me object) because i need to callback an a
specific sub and activity from the JobDone. I am using the CallSub2 from the activity that make the http call with the (Me) object parameter, in the service Sub seting the Job.tag, finally make the http post and try to get the TAG in the JobDone sub. When I try to access the "tag" property like this: CallSub2(job.tag,"mysub","myparams") an a "ClassCastException" ocurred.

I have a one service module to handle all the http calls, for this reason i need to know what activiy and sub did the call, for a while (realy years ) i was using a public object variable, but that solution not work in asynchronous environments and I want to continue centralizing operations "http " is just a service.

This is the log:

** Activity (main) Pause, UserClosed = false **
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = true **
** Activity (acceso) Create, isFirst = true **
** Activity (acceso) Resume **
** Service (webservice) Create **
** Service (webservice) Start **
** Service (httputils2service) Create **
** Service (httputils2service) Start **
Error occurred on line: 231 (webservice)
java.lang.RuntimeException: java.lang.ClassCastException: java.lang.Object
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:910)
at anywheresoftware.b4a.keywords.Common.CallSubNew2(Common.java:839)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:703)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:340)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:247)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at anywheresoftware.b4a.BA$2.run(BA.java:328)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:123)
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:842)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassCastException: java.lang.Object
at anywheresoftware.b4a.keywords.Common.getComponentBA(Common.java:1036)
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:893)
... 19 more
** Service (starter) Destroy **
** Activity (acceso) Pause, UserClosed = true **
** Service (webservice) Destroy **
** Activity (main) Resume **


Thank for your support

Best regards.
 
Top