Hi all,
I need to convert a single byte to a string
I use this code to create the byte:
(this is an Erel code)
The log is this:
Now I want convert b to a string (wstr) :
but I have an error
How can I solve?
Thanks in advance
I need to convert a single byte to a string
I use this code to create the byte:
B4X:
Dim b As Byte
Dim wstr As String
b = 23
LogByte(b)
b = SetBit(b, 0, False)
LogByte(b)
The log is this:
B4X:
00010111
00010110
Now I want convert b to a string (wstr) :
B4X:
wstr = BytesToString(b, 0, 1, "UTF8")
LogByte(wstr)
but I have an error
B4X:
java.lang.ArrayIndexOutOfBoundsException: length=0; index=0
at com.mamavi.slimup.main._activity_create(main.java:1974)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
at com.mamavi.slimup.main.afterFirstLayout(main.java:104)
at com.mamavi.slimup.main.access$000(main.java:17)
at com.mamavi.slimup.main$WaitForLayout.run(main.java:82)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:7000)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:441)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)
Thanks in advance