Android Question read/write list view

mohsen nasrabady

Active Member
Licensed User
hi i used this code to read a listview but error
java.lang.RuntimeException: Object should first be initialized (ListView).

but the listview is initialized

what's the problem?

B4X:
Dim ra As RandomAccessFile
ra.Initialize(File.DirInternal,"gamelist",False)
gamelist = ra.ReadObject(0)
gamelist.Invalidate
ra.Close
 

mohsen nasrabady

Active Member
Licensed User
i used this code to save the listview with two line and bitmap
the recoglist and recogsize is map
i did the data of two line and bitmap in the maps
B4X:
For i = 0 To list1.Size-1
gamelist.AddTwoLinesAndBitmap(list1.Get(i),recogsize.Get(list1.Get(i))&" MB",recoglist.Get(list1.Get(i)))
Next
Dim ra As RandomAccessFile
ra.Initialize(File.DirInternal,"gamelist",False)
ra.WriteObject(list1,True,0)
ra.WriteObject(recogsize,True,ra.CurrentPosition)
ra.WriteObject(recoglist,True,ra.CurrentPosition)
ra.Close
but when read with this code the bitmap is null

B4X:
Dim ra As RandomAccessFile
ra.Initialize(File.DirInternal,"gamelist",False)
list1 = ra.ReadObject(0)
recogsize = ra.ReadObject(ra.CurrentPosition)
recoglist = ra.ReadObject(ra.CurrentPosition)
ra.Close
gamelist.Clear
For i = 0 To list1.Size-1
gamelist.AddTwoLinesAndBitmap(list1.Get(i),recogsize.Get(list1.Get(i))&" MB",recoglist.Get(list1.Get(i)))
Next
every thing is ok just bitmap is null
 
Last edited:

mohsen nasrabady

Active Member
Licensed User
i used the class but when reading return error

android.database.sqlite.SQLiteException: unknown error: INTEGER data in nativeGetBlob

B4X:
For i = 0 To list1.Size-1
Dim ssize As String = recogdata.GetSimple(list1.Get(i))&" MB"
Dim sbitmap As Bitmap = recogdata.GetBitmap(list1.Get(i))
gamelist.AddTwoLinesAndBitmap(list1.Get(i),ssize,sbitmap)
Next
 
Top