Das gibt leider eine Fehlermeldung!
java.lang.NumberFormatException: empty String
at java.lang.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1071)
at java.lang.Double.parseDouble(Double.java:547)
at b4a.example.main._btnplay_click(main.java:403)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:186)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:170)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:166)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
at android.view.View.performClick(View.java:6199)
at android.widget.TextView.performClick(TextView.java:11090)
at android.view.View$PerformClick.run(View.java:23647)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6682)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
java.lang.NumberFormatException: empty String
Hier mal der gesamte Code
#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
#BridgeLogger: True
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Private streamer As AudioStreamer
Private buffers As List
Private timer1 As Timer
Private recordingStart As Long
End Sub
Sub Globals
Dim Label1 As Label
Dim btnPlay As Button
Dim btnStartRecording As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("1")
If FirstTime Then
streamer.Initialize("streamer", 44100, True, 16, streamer.VOLUME_MUSIC)
buffers.Initialize
timer1.Initialize("timer1", 1000)
End If
End Sub
Sub streamer_RecordBuffer (Buffer() As Byte)
'collect the recording data
buffers.Add(Buffer)
End Sub
Sub btnStartRecording_Click
buffers.Clear
streamer.StartRecording
recordingStart = DateTime.Now
timer1.Enabled = True
Timer1_Tick
btnPlay.Enabled = False
End Sub
Sub Timer1_Tick
Label1.Text = "Recording: " & _
Round((DateTime.Now - recordingStart) / DateTime.TicksPerSecond) & " seconds"
End Sub
Sub btnStopRecording_Click
streamer.StopRecording
timer1.Enabled = False
btnPlay.Enabled = True
Label1.Text = ""
End Sub
Sub btnPlay_Click
btnStartRecording.Enabled = False
streamer.StartPlaying
For Each b() As Byte In buffers
streamer.Write(b)
Next
' Bytes an String anhängen und als Log ausgeben
For Each b() As Byte In buffers
Dim s As String = ""
Dim len As Int = b.Length
For i = 0 To len - 1
s = s + " " + b(i)
Next
Log(s)
Next
streamer.Write(Null) 'when this "message" will be processed, the player will stop.
End Sub
Sub streamer_PlaybackComplete
Log("PlaybackComplete")
btnStartRecording.Enabled = True
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub