Hi all,
I have a problem with the keyvaluestore class (kvs). The kvs will be created with B4J and contains some information which I use as content in a self-guided-tour app, mainly html with base64 encoded images. some of the produced kvs are showing normal behaviour in B4A. But some of the kvs, depending on the images in the html-code could not be loaded in B4A (in B4J they are ok and can be loaded...).
The error is in: keyvaluestore_getobjectinternal
java.lang.IllegalStateException: Couldn't read row 0, col 0 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it.
The testcode is pretty short:
The whole project can be downloaded here (https://dl.dropboxusercontent.com/u/23685552/test.zip) and contains two kvs: testcontent_error.app (produces an error in B4A) and testcontent.app (error free in B4A). The difference is only one POI object (html page with images).
Any help on that issue will be appreciated...
Best
Stefan
I have a problem with the keyvaluestore class (kvs). The kvs will be created with B4J and contains some information which I use as content in a self-guided-tour app, mainly html with base64 encoded images. some of the produced kvs are showing normal behaviour in B4A. But some of the kvs, depending on the images in the html-code could not be loaded in B4A (in B4J they are ok and can be loaded...).
The error is in: keyvaluestore_getobjectinternal
java.lang.IllegalStateException: Couldn't read row 0, col 0 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it.
The testcode is pretty short:
B4X:
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Type POI (id As Int, name As String, teaser As String, text As String, factsTitle As String, facts As String, Latitude As Double , Longitude As Double, _
SliderBild1 As String, sliderBild2 As String, sliderText1 As String, sliderText2 As String, ARBild As String, ARAngle As Int, _
Media1 As String, Mediasize1 As Double, Media2 As String, Mediasize2 As Double, icon As String, dist As Double)
Private POImap As Map
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("1")
Dim f As String
f = "testcontent_error.app" 'this produces the error
f = "testcontent.app" 'this kvs makes no error
If FirstTime Then
File.Copy(File.DirAssets,f, File.DirInternal, f)
End If
Dim kvs As KeyValueStore
kvs.Initialize(File.DirInternal,f)
POImap = kvs.getObject("poimap")
Dim p As POI
p = POImap.GetValueAt(1)
Log(p.text) 'output html with images base64 encoded
Dim html As String
html = p.text
html = html.replace("contenteditable=" & Chr(34) & "true" & Chr(34), "contenteditable=" & Chr(34) & "false" & Chr(34)) 'make the html non editable
WebView1.LoadHtml(html) 'show page of html
End Sub
The whole project can be downloaded here (https://dl.dropboxusercontent.com/u/23685552/test.zip) and contains two kvs: testcontent_error.app (produces an error in B4A) and testcontent.app (error free in B4A). The difference is only one POI object (html page with images).
Any help on that issue will be appreciated...
Best
Stefan
Last edited: