Android Question CloudKVS & Item ID

luke2012

Well-Known Member
Licensed User
Longtime User
The Good
@Erel I confirm you that I'm following your suggestion and I'm using a UUID for each new item putted in to the Cloud (works very well).
This UUID solve the problem of data updated by multiple clients at the same time (as you suggested) and I can have an solid unique item id.

The problem:
My problem now is that I can't display that UUID (very very long and impossible to remember) to the end user in order to let him identify the item within an item list and probably I need a progressive number to display to user within the App (ex. item n.1, item n.2 etc...).

Some custom item have a item name different from each item within the item list that I show within the app, but there are some custom items that doesn't have a name, but also some data (numeric data for example) but the end user cannot identify items because there haven't name or number (he can't see item n. 1 etc).

Any Idea?

Thanks in advance for your precious help.
 

luke2012

Well-Known Member
Licensed User
Longtime User
@Informatix suggest to compute the long UUID string to an hash code (The solution to get a long from a string is to compute a hash) :

B4X:
Sub HashCode(s As String) As Long
   Dim h As Long = 0
   For i = 0 To s.Length - 1
      h = 151 * h + (Asc(s.CharAt(i)) - 32)
   Next
   Return h
End Sub
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…