Sub btnStart_Click
Dim in As Intent
Dim stamp As String
in.Initialize("android.provider.MediaStore.RECORD_SOUND", "")
StartActivityForResult(in)
Wait For ion_event (MethodName As String, Args() As Object)
Log("#2 " & MethodName)
Log("#3 " & Args(0))
Dim resultCode As Int = Args(0)
If resultCode = -1 Then ' Ok
Dim in As Intent = Args(1)
Log("#5 " & in.GetData)
Dim uri As String = in.GetData
stamp = DateTime.Now & ".mp3"
File.Copy("ContentDir", uri, File.DirInternal, stamp)
DropBox.UploadFile(File.DirInternal, stamp, "AudioRecording")
SetProgressBar(stamp)
Else
'MsgboxAsync("You may not have a default audio recorder for this device. A suggested app from Google Play is the Samsung Voice Recorder.", "")
End If
End Sub
Sub StartActivityForResult(i As Intent)
Dim jo As JavaObject = GetBA
ion = jo.CreateEvent("anywheresoftware.b4a.IOnActivityResult", "ion", Null)
jo.RunMethod("startActivityForResult", Array As Object(ion, i))
End Sub
Sub GetBA As Object
Dim jo As JavaObject = Me
Return jo.RunMethod("getBA", Null)
End Sub