I would normally not necropost, but my question is highly relevant.
I am using the above verbatim, a button click should make a new uuid
however, I am getting java lang NoSuchMethodException:tostring
as I test, I would add msgbox("my new uuid","") and see my correctly generated uuid, but I am unsure what to put in place of "my new uuid"
Sub nuuid_click As String
r.Target = r.RunStaticMethod("java.util.UUID", "randomUUID", Null, Null)
Return r.RunMethod("ToString")
End Sub
I get this when I click the button:
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:anywheresoftware.b4a.samples.xmlsax
** Activity (main) Create, isFirst = true **
>>> [SSH]: Connection was successfully established.
>>> [SSH]: Starting download of file 'Win10.xml' with TaskId 12...
>>> [SSH]: Command was successfully executed.
>>> [SSH]: Connection was successfully established.
>>> [SSH]: Task with ID 25 is already running...
** Activity (main) Resume **
>>> [SSH]: Connection was successfully established.
>>> [SSH]: Command was successfully executed.
>>> [SSH]: Command was successfully executed.
main_nuuid_click (java line: 669)
java.lang.NoSuchMethodException: ToString() []
at java.lang.Class.getConstructorOrMethod(Class.java:460)
at java.lang.Class.getDeclaredMethod(Class.java:685)
at anywheresoftware.b4a.agraham.reflection.Reflection.runmethod(Reflection.java:214)
at anywheresoftware.b4a.agraham.reflection.Reflection.RunMethod(Reflection.java:802)
at anywheresoftware.b4a.samples.xmlsax.main._nuuid_click(main.java:669)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:187)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:175)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:171)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:78)
at android.view.View.performClick(View.java:3511)
at android.view.View$PerformClick.run(View.java:14105)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132)
at dalvik.system.NativeStart.main(Native Method)
java.lang.NoSuchMethodException: ToString() []
Thanks Erel,
I changed ToString to toString and it no longer throws the error.
Is that what you identified as incorrect?
However, I still don't know how to get the generated UUID.
How would I display the new UUID, say in a msgbox("????","") ?
I know this is very late. But I'd like to share my working code to generate UUID in B4J. As a requirement, must select from the Library: JavaObject.
B4X:
Sub GenerateUUID() As String
Dim jObj As JavaObject
jObj.InitializeStatic("java.util.UUID")
Dim uuid As String = jObj.RunMethod("randomUUID", Null)
Return uuid
End Sub
Get Unique hardware ID in b4j tested on windows only you can test on mac or linux 8 method to get Unique hardware id updated v1.8 fixed error in none_ui apps removed all unnecessary methods two new method added Get_HWID1 Get_HWID2 updated v2.0 Using java standard functions without...
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.