Android Question The program always crashes the log report

cxdzbl

Active Member
Licensed User
I used customlistview-1.76
KeyValueStore: v2.00
IDE 7.3
The main function is to chat in time, and each send (customlistview.add (panel, height, value)) always appears once
"Panel, size, is, unknown., Layout, may, not, be, loaded, correctly.."".
A crash occurred when sending more than ten pictures. The error log is the following:

Check the unfiltered logs for the full stack trace.
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
[objWFI_onInitialized]
Network WIFI connected
WifiAvailable:true
WifiConnected:true
Ping not available in Demo Version.** DONATIONWARE **
MobileAvailable:true
BroadcastReceiver::eek:nReceive::android.net.conn.CONNECTIVITY_CHANGE
** Activity (main) Pause, UserClosed = false **
** Activity (live_chat1) Create, isFirst = true **
Class not found: ycwx.ycsst.customlistview, trying: b4a.liveChat.customlistview
** Activity (live_chat1) Resume **
-----------Here is the grey information------------
Panel size is unknown. Layout may not be loaded correctly.
Panel size is unknown. Layout may not be loaded correctly.
Panel size is unknown. Layout may not be loaded correctly.
Panel size is unknown. Layout may not be loaded correctly.
Panel size is unknown. Layout may not be loaded correctly.
Panel size is unknown. Layout may not be loaded correctly.
Panel size is unknown. Layout may not be loaded correctly.
Panel size is unknown. Layout may not be loaded correctly.
Panel size is unknown. Layout may not be loaded correctly.
Panel size is unknown. Layout may not be loaded correctly.
Panel size is unknown. Layout may not be loaded correctly.
Panel size is unknown. Layout may not be loaded correctly.
Panel size is unknown. Layout may not be loaded correctly.
Panel size is unknown. Layout may not be loaded correctly.

-------------Here is the red message when the crash occurs----------------------------------

Error occurred on line: 26 (KeyValueStore)
java.lang.IllegalStateException: Couldn't read row 0, col 0 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it.
at android.database.CursorWindow.nativeGetBlob(Native Method)
at android.database.CursorWindow.getBlob(CursorWindow.java:416)
at android.database.AbstractWindowedCursor.getBlob(AbstractWindowedCursor.java:45)
at anywheresoftware.b4a.sql.SQL$CursorWrapper.GetBlob2(SQL.java:431)
at b4a.liveChat.keyvaluestore._get(keyvaluestore.java:75)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:710)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:339)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:139)
at anywheresoftware.b4a.BA$2.run(BA.java:360)
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:6646)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)
 

eps

Expert
Licensed User
Longtime User
Looks like you haven't initiliazed KeyValueStore or aren't using it properly...

"
Error occurred on line: 26 (KeyValueStore)
java.lang.IllegalStateException: Couldn't read row 0, col 0 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it.
"
It's a 'DB' error - I guess the KeyValueStore uses it's own DB to store and retrieve information.
 
Upvote 0

cxdzbl

Active Member
Licensed User
Looks like you haven't initiliazed KeyValueStore or aren't using it properly...

"
Error occurred on line: 26 (KeyValueStore)
java.lang.IllegalStateException: Couldn't read row 0, col 0 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it.
"
It's a 'DB' error - I guess the KeyValueStore uses it's own DB to store and retrieve information.
The following is the initialization code
B4X:
Dim folder As String
    If File.ExternalWritable Then folder = File.DirDefaultExternal Else folder = File.DirInternal
    ycwx_live.Initialize(folder, "datastore")
    ycwx_live.DeleteAll

I just tested it, and if you don't have the following code, there's no problem:

B4X:
Dim m As Message  'Type Message (id As String,name As String,userIMG() As Byte,file_type As Int, mess As String,value() As Byte,muinfo As Long,time As String,bmpH As Int,bmpW As Int)
If ycwx_live.ContainsKey("chat1") Then
        Dim chat1 As List=ycwx_live.Get("chat1")
        chat1.add(m)
        ycwx_live.Put("chat1",chat1)
Else
        ycwx_live.Put("chat1",m)
        Dim chat1 As List
        chat1.Initialize
        chat1.add(m)
        ycwx_live.Put("chat1",chat1)
End If
 
Last edited:
Upvote 0

cxdzbl

Active Member
Licensed User
Please use [code]code here...[/code] tags when posting code.
I've formatted the code, and I wonder if each type of picture is stored. Is it too big to crash, or am I using the wrong method?. Because I want to save every message, do I need to use cache? There is no problem with sending 50 messages without adding the above code (including pictures)
 
Upvote 0

TIMX

Member
Licensed User
BLOBs larger than 1mb or 2mb (depending on the Android version) will fail. This is an Android limitation.
I have the same Problem, I use base64 library to compress but it not enough, the coded text is larger than 1mb and Android send the same exception.

B4X:
java.lang.IllegalStateException: Couldn't read row 0, col 0 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it.

I tried to set custom parameters to the camera, but the Samsung J2 camera, failed and stopped.
 
Upvote 0
Top