Android Question android.database.CursorIndexOutOfBoundsException error

apty

Active Member
Licensed User
Longtime User
What would cause the error below?:

B4X:
android.database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of 149

I have an app which was just working fine inserting and reading data from sqlite database but from yesterday it stopped working generating the above error.
 

DonManfred

Expert
Licensed User
Longtime User
What would cause the error below?:
The bad weather in Florida?

Help us helping you:
Start with posting all relevant code so we could give a more congrete answer. Best is to upload a small project which shows the issue.
 
Upvote 0

apty

Active Member
Licensed User
Longtime User
The code below is the one generating the error. Everything was working fine until yesterday

B4X:
Dim SenderFilter As Object = Starter.sql1.ExecQueryAsync("SQL", "SELECT * FROM newnames order by firstname asc", Null)
    Wait For (SenderFilter) SQL_QueryComplete (Success As Boolean, rs As ResultSet)
    
    Log(Success)
    If Success Then
        Do While rs.NextRow
lsUsers.AddTwoLinesAndBitmap2(rs.GetString("firstname"),rs.GetString("lastname"),BytesToImage(rs.GetBlob("usericon")),rs.GetString("username"))
Loop
        rs.Close
    Else
        Log(LastException)
        
    End If
 
Upvote 0

apty

Active Member
Licensed User
Longtime User
The full error log is as below:
B4X:
true
main$ResumableSub_loaduserlistresume (java line: 1981)
android.database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of 149
    at android.database.AbstractCursor.checkPosition(AbstractCursor.java:460)
    at android.database.AbstractWindowedCursor.checkPosition(AbstractWindowedCursor.java:136)
    at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:50)
    at anywheresoftware.b4a.sql.SQL$CursorWrapper.GetString(SQL.java:377)
    at users.icons.listm.main$ResumableSub_loaduserlist.resume(main.java:1981)
    at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:245)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:185)
    at anywheresoftware.b4a.BA$2.run(BA.java:365)
    at android.os.Handler.handleCallback(Handler.java:789)
    at android.os.Handler.dispatchMessage(Handler.java:98)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6938)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
 
Upvote 0

apty

Active Member
Licensed User
Longtime User
the app started working again without any modification to the code. I don't know what was happening.
 
Upvote 0
Top