already searched forum, but how to determin a size of array or type in B4a?
For random acess i need to forward the point to a offset i*sizeof(y) where i is the pointer to the stored location and y and var which holds the type of vars
it works for 1 var inside the type
i could make a adding of all the var's inside the type, that should work, but there must be a much easier way, only i dont know the equivalent in basic or b4a basic
Normally in #c you say sizeof(array) etc
i'm saving several files, random each of type "spots" To index the pointer i need to know the size of "spots". I found this manually (304 bytes) so the application is working
the best way is to count each var inside the type like Erel mentioned in his answer. Basic doesnt seem to have a equivalent command of sizeof in C#
If the Type holds non string variables then the length would be dependent on the value of the variable value, if the values are numeric, you could cast them to a string and measure their length but if they are boolean or another class or type then it would be more complicated.
one way is to set the length much larger then the actual size of type. Then the file contains blocks where the type will fit. This works, but not a nice way...
Two options:
1. Add all the type instances to a List and save the list with WriteB4XObject. You can then load the list and work with it.
2. Use KeyValueStore class.