I send a sql request and I get:
Response from server: [{"id":"1","name":"daily"},{"id":"2","name":"2_weeks"},{"id":"3","name":"monthly"},{"id":"4","name":"3_months"},{"id":"5","name":"year"}]
my code is:
Dim parser As JSONParser
parser.Initialize(res)
Dim l As List
l = parser.NextArray
For i = 0 To l.Size- 1
Dim m As Map
m = l.Get(i)
spnCLCompany.Add(m.Get("name"))
Next
but I get the error:
java.lang.RuntimeException: JSON Array expected.
at anywheresoftware.b4a.objects.collections.JSONParser.NextArray(JSONParser.java:59)
at danoptic.onlinestore.choosecl._hc_responsesuccess(choosecl.java:541)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:170)
at anywheresoftware.b4a.BA$3.run(BA.java:296)
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)
java.lang.RuntimeException: JSON Array expected.
java.lang.RuntimeException: Failed to register input channel. Check logs for details.
at android.view.InputQueue.nativeRegisterInputChannel(Native Method)
at android.view.InputQueue.registerInputChannel(InputQueue.java:92)
at android.view.ViewRoot.setView(ViewRoot.java:572)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:177)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
at android.view.Window$LocalWindowManager.addView(Window.java:424)
at android.app.Dialog.show(Dialog.java:241)
at anywheresoftware.b4a.Msgbox.msgbox(Msgbox.java:135)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:210)
at anywheresoftware.b4a.BA$3.run(BA.java:296)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
what I m doing wrong !!!:sign0085:
Response from server: [{"id":"1","name":"daily"},{"id":"2","name":"2_weeks"},{"id":"3","name":"monthly"},{"id":"4","name":"3_months"},{"id":"5","name":"year"}]
my code is:
Dim parser As JSONParser
parser.Initialize(res)
Dim l As List
l = parser.NextArray
For i = 0 To l.Size- 1
Dim m As Map
m = l.Get(i)
spnCLCompany.Add(m.Get("name"))
Next
but I get the error:
java.lang.RuntimeException: JSON Array expected.
at anywheresoftware.b4a.objects.collections.JSONParser.NextArray(JSONParser.java:59)
at danoptic.onlinestore.choosecl._hc_responsesuccess(choosecl.java:541)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:170)
at anywheresoftware.b4a.BA$3.run(BA.java:296)
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)
java.lang.RuntimeException: JSON Array expected.
java.lang.RuntimeException: Failed to register input channel. Check logs for details.
at android.view.InputQueue.nativeRegisterInputChannel(Native Method)
at android.view.InputQueue.registerInputChannel(InputQueue.java:92)
at android.view.ViewRoot.setView(ViewRoot.java:572)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:177)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
at android.view.Window$LocalWindowManager.addView(Window.java:424)
at android.app.Dialog.show(Dialog.java:241)
at anywheresoftware.b4a.Msgbox.msgbox(Msgbox.java:135)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:210)
at anywheresoftware.b4a.BA$3.run(BA.java:296)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
what I m doing wrong !!!:sign0085: