W wl Well-Known Member Licensed User Longtime User Dec 30, 2014 #1 Hi, I'm would like to generate a unique ID (GUID) in my B4J application. I know there is a thread in B4A asking the same question. What would be the solution in B4J: also use an external Java library ? I noticed DateTime (expressed in ticks) can't be used for this (I iterated a simple loop 250 times and only got two different tick values). A possible solution might be to take the DateTime and add some random value ? Other suggestions ? Tx
Hi, I'm would like to generate a unique ID (GUID) in my B4J application. I know there is a thread in B4A asking the same question. What would be the solution in B4J: also use an external Java library ? I noticed DateTime (expressed in ticks) can't be used for this (I iterated a simple loop 250 times and only got two different tick values). A possible solution might be to take the DateTime and add some random value ? Other suggestions ? Tx
Erel B4X founder Staff member Licensed User Longtime User Dec 30, 2014 #2 You can use this sub: B4X: Sub UUID As String Dim jo As JavaObject Return jo.InitializeStatic("java.util.UUID").RunMethod("randomUUID", Null) End Sub Upvote 0
You can use this sub: B4X: Sub UUID As String Dim jo As JavaObject Return jo.InitializeStatic("java.util.UUID").RunMethod("randomUUID", Null) End Sub