I've got two acitivities.
Activity A works like a charm
In Activity B I've the following (exactly the same) but called from a button in activity B.
Function "Routecall" is in a Service "Com"
Error is:
Why does the first action work and the second doesn't?
Activity A works like a charm
B4X:
Sub oBtn_Click
CallSub2(Com,"Routecall","")
End Sub
In Activity B I've the following (exactly the same) but called from a button in activity B.
B4X:
Sub CheckAfterLast
CallSub2(Com,"RouteCall","")
End Sub
Function "Routecall" is in a Service "Com"
B4X:
Sub RouteCall(XMLparameters As String) 'As Int
Dim requestSoapXML As String
Dim sChar As String
Dim Soap As HttpJob
Dim i, iReturn As Int
XMLparameters = Globaal.String2Base64(XMLparameters)
XMLparameters = "||"&XMLparameters
XMLparameters = Globaal.String2Base64(XMLparameters)
sChar = "&"
iReturn=0
requestSoapXML = Globaal.MainUrl&"/Getdata13/JSON?ipar="&Globaal.par1&sChar&"spar="&Globaal.par2
If Globaal.DoLog=1 Then Log(requestSoapXML)
Soap.Initialize("GetRoute",Me)
Soap.Download(requestSoapXML)
wait for (Soap) jobdone(Soap As HttpJob) '<<<<<< fails on this line when from Activity B
If (Soap.Success = True) Then
'do something
end if
Error is:
B4X:
Error occurred on line: 817 (Com)
java.lang.NullPointerException
at anywheresoftware.b4a.keywords.Common.WaitFor(Common.java:1738)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:777)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:354)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:1083)
at anywheresoftware.b4a.keywords.Common.CallSubNew2(Common.java:1038)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:180)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:176)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
at android.view.View.performClick(View.java:4463)
at android.view.View$PerformClick.run(View.java:18770)
at android.os.Handler.handleCallback(Handler.java:808)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5333)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
at dalvik.system.NativeStart.main(Native Method)
Why does the first action work and the second doesn't?
Last edited: