Android Question Saving Arrays with KeyValueStore2 impossible?

Herbert32

Active Member
Licensed User
Longtime User
Hi together,

with KeyValueStore, saving Arrays was really simple...

https://www.b4x.com/android/forum/threads/saving-an-array-with-kvs.48213/



it seems, saving arrays by this way doesn't work in KeyValueStore2 - right?


If 'yes' - where can i find infos about how to save arrays with KVS2 - or is it impossible? - Should i use KeyValueStore instead of KeyValueStore2 ?


I tried this without success:

B4X:
Sub Process_Globals

    Dim KVS As KeyValueStore
    Dim ETC As Int = 255
    Dim EPreis(ETC,7) As Double

End Sub

Sub Service_Create

    KVS.Initialize(File.DirInternal, "myData")
    EPreis=KVS.GetDefault("EPreis",0)

End Sub



best regards
Herbert
 

DonManfred

Expert
Licensed User
Longtime User
The problem is maybe that kvs2 is Crossplatform. Serialisation is done through b4xserialisator

This is what KVs2 can do
Lists, Maps, Strings, primitives (numbers), user defined types and arrays (only arrays of bytes and arrays of objects are supported).
I suggest to change the Array to a Map or a List.
Or to change the two dimensional array to a list of Customtypes.
 
Last edited:
Upvote 0
Top