Android Question Getting Double value from KVS blob value?

RB Smissaert

Well-Known Member
Licensed User
Longtime User
Just wondering if this is possible.
If I store to KVS a double value 1:

B4X:
'cMP.dMilliSecsPerMapTile will be 1
Starter.kvs.Put("Milli seconds per map tile download", cMP.dMilliSecsPerMapTile)

and read the blob by connecting to the KVS database I get these bytes:

i: 0, byte: 120
i: 1, byte: -100
i: 2, byte: 99
i: 3, byte: 99
i: 4, byte: 0
i: 5, byte: -125
i: 6, byte: 15
i: 7, byte: -10
i: 8, byte: 0
i: 9, byte: 2
i: 10, byte: 94
i: 11, byte: 1
i: 12, byte: 54

Looking at this I guess it is not possible, without knowing how exactly KVS stores these double values.

RBS
 

RB Smissaert

Well-Known Member
Licensed User
Longtime User
It looks like you are doing something wrong. maybe dMilliSecsPerMapTile is declared as byte.
No, dMilliSecsPerMapTile is declared as double:

in B4XMainPage:

B4X:
Sub Class_Globals
    Public dMilliSecsPerMapTile As Double

RBS
 
Upvote 0

RB Smissaert

Well-Known Member
Licensed User
Longtime User
It looks like you are doing something wrong. maybe dMilliSecsPerMapTile is declared as byte.
All solved now and all I have to do is deserialize ( B4XSerializator) the byte array with for example:

B4X:
Dim dRes As Double = ser.ConvertBytesToObject(arrBytes)

RBS
 
Upvote 0
Top