log
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
** Activity (main) Resume **
*** Service (myservice) Create ***
** Service (myservice) Start **
34.9912109375
Error occurred on line: 68 (B4XMainPage)
java.lang.NumberFormatException: For input string: "35 Kb"
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2043)
at sun.misc.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
at java.lang.Double.parseDouble(Double.java:538)
at anywheresoftware.b4a.debug.RDebugUtils.numberCast(RDebugUtils.java:58)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:146)
at anywheresoftware.b4a.debug.Debug.delegate(Debug.java:262)
at com.robloxi.client.b4xmainpage._sendfm(b4xmainpage.java:392)
at com.robloxi.client.myservice._str_newdata(myservice.java:1863)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:146)
at anywheresoftware.b4a.BA$2.run(BA.java:387)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6737)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:860)
java.lang.Exception: java.lang.NumberFormatException: For input string: "35 Kb"
** Receiver (starter) OnReceive **
The Starter service should never be started from a receiver.
** Service (starter) Start **
** Receiver (myservice) OnReceive **
** Service (myservice) Start **
code
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
** Activity (main) Resume **
*** Service (myservice) Create ***
** Service (myservice) Start **
34.9912109375
Error occurred on line: 68 (B4XMainPage)
java.lang.NumberFormatException: For input string: "35 Kb"
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2043)
at sun.misc.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
at java.lang.Double.parseDouble(Double.java:538)
at anywheresoftware.b4a.debug.RDebugUtils.numberCast(RDebugUtils.java:58)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:146)
at anywheresoftware.b4a.debug.Debug.delegate(Debug.java:262)
at com.robloxi.client.b4xmainpage._sendfm(b4xmainpage.java:392)
at com.robloxi.client.myservice._str_newdata(myservice.java:1863)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:146)
at anywheresoftware.b4a.BA$2.run(BA.java:387)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6737)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:860)
java.lang.Exception: java.lang.NumberFormatException: For input string: "35 Kb"
** Receiver (starter) OnReceive **
The Starter service should never be started from a receiver.
** Service (starter) Start **
** Receiver (myservice) OnReceive **
** Service (myservice) Start **
code
B4X:
Sub FormatFileSize(Bytes As Float) As String
Private Unit() As String = Array As String(" Byte", " Kb", " Mb", " Gb", " Tb", " Pb", " Eb", " Zb", " Yb")
If Bytes = 0 Then
Return "0 Bytes"
Else
Private Po, Si As Double
Private I As Int
Bytes = Abs(Bytes)
I = Floor(Logarithm(Bytes, 1024))
Po = Power(1024, I)
Si = Bytes / Po
Log(Si)
Return NumberFormat(Si, 0, 1) & " "& Unit(I)
End If
End Sub