B4J Question NativeObject Type Doesn't Exist

Discussion in 'B4J Questions' started by Squiffy, Aug 9, 2015.

  1. Squiffy

    Squiffy Member Licensed User

    Hi - I'm trying to do this (following another thread to create UUIDs) :

    Dim no As NativeObject
    Return no.Initialize("NSUUID").RunMethod("UUID", Null).RunMethod("UUIDString", Null).AsString

    but it complains that there is no NativeObject type. Should there be in B4j? I've tried adding all of the libraries in the manager but it doesn't seem to exist.
     
  2. rwblinn

    rwblinn Well-Known Member Licensed User

    Try using a JavaObject (LIbrary JavaObject)

    #Example Sub to retrieve a type 4 (pseudo randomly generated) UUID.
    Code:
    Sub UUID As String
       
    Dim joUUID As JavaObject
       
    Return joUUID.InitializeStatic("java.util.UUID").RunMethod("randomUUID"Null)
    End Sub
    Output:
    Log("UUID: " & UUID)
    UUID: 59ec389c-6ba2-46fb-bd6b-e33b5a24ce74
     
    ricardotm1968 and Erel like this.
  3. Squiffy

    Squiffy Member Licensed User

    Ah, that's the johnny! Works perfectly, thanks.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice