Android Question map Error

aligol

Member
who knows why I'm getting the following Error and how should I fix that?
please somebody help me.
thanks

B4X:
    cur = sql1.ExecQuery2("SELECT * FROM tblvoc where subid=?",Array As String(act_lessons.val))
    For i = 0 To cur.RowCount - 1
        cur.Position = i
        Dim m As Map
        m.Initialize
            m.Put("id",cur.GetInt("id"))
            m.Put("word",cur.GetString("word"))
            m.Put("pronunciation",cur.GetString("pronunciation"))
            m.Put("meaning",cur.GetString("meaning"))
            m.Put("EnExample",cur.GetString("EnExample"))
            m.Put("FaExample",cur.GetString("FaExample"))
            m.Put("sound",cur.GetString("sound"))
            m.Put("likee",cur.GetInt("likee"))
            
        itemlist.Get(m)
        Next


Logs:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create (first time) **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (act_lessons) Create (first time) **
** Activity (act_lessons) Resume **
** Activity (act_lessons) Pause, UserClosed = false **
** Activity (actdata) Create (first time) **
Error occurred on line: 134 (actData)
java.lang.NumberFormatException: For input string: "(MyMap) {id=1, word= abate , pronunciation=/əˈbeɪt/, meaning= کاستن تخفیف دادن رفع نمودن کم شدن اب گرفتن از (فلز), EnExample=The crew of the ship waited for the storm to abate before going on deck to make repairs, FaExample=null, sound=abate.MP3, likee=1}"
    at java.lang.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1306)
    at java.lang.Double.parseDouble(Double.java:547)
    at anywheresoftware.b4a.debug.RDebugUtils.numberCast(RDebugUtils.java:67)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:205)
    at anywheresoftware.b4a.debug.Debug.delegate(Debug.java:262)
    at b4a.example.actdata._init_data(actdata.java:642)
    at b4a.example.actdata._activity_create(actdata.java:418)
    at java.lang.reflect.Method.invoke(Native Method)
    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.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
    at b4a.example.actdata.afterFirstLayout(actdata.java:105)
    at b4a.example.actdata.access$000(actdata.java:17)
    at b4a.example.actdata$WaitForLayout.run(actdata.java:83)
    at android.os.Handler.handleCallback(Handler.java:751)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6190)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:892)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:782)
** Activity (actdata) Resume **
 
Solution
Using Cursor is bad practice. Switch to ResultSet.
Using Activities is bad practice. Switch to B4XPages.
Using parameterized queries is good practice ?

What is the purpose of this strange line:
B4X:
itemlist.Get(m)

It causes the error.

aligol

Member
Using Cursor is bad practice. Switch to ResultSet.
Using Activities is bad practice. Switch to B4XPages.
Using parameterized queries is good practice ?

What is the purpose of this strange line:
B4X:
itemlist.Get(m)

It causes the error.
thank you for your advices
 
Upvote 0
Top