Android Question How can I store coordintes in a list?

Mark Read

Well-Known Member
Licensed User
Longtime User
I have an array (x,y,value1, value2, value3), where x and y are screen coordinates and have certain calculated values. Moving around the screen, certain points will be assigned values (others not) and then moved to a list. The list will then contain all three values plus the coordinates and has to be sorted according to value3.

What is the best way to store in the list?

Thanks for any help.
 
Last edited:

derez

Expert
Licensed User
Longtime User
Options:
1. Make a st as string with separating commas: st = x & "." & y & "," & value1 & "," .... and store each string in the list
to read use : a string array str() , str = regex.split("," ,list.get(i) )
2. Make a type : Type MyType(X as int, Y as int, value1 as .....) , then define a variable as that type: dim mtp as mytype and store each mtp in the list. to read use mtp = list.get(i) , and x = mtp.x , y = mtp.y etc.
3. If the data should be available in the next run of the application you can use my modification to KeyValueStore here http://www.b4x.com/android/forum/threads/keyvalues-extended-keyvaluestore.32553/

Option 2 can be sorted according to value3 :
list.SortType("Value3", true)
 
Last edited:
Upvote 0

Mark Read

Well-Known Member
Licensed User
Longtime User
Option 2 is perfect, thank you.
 
Upvote 0
Top