Sub cmdReminderPick_Click
rm.ShowRingtonePicker("rm", Bit.Or(rm.TYPE_ALARM,rm.TYPE_NOTIFICATION), True, AlarmURI)
End Sub
Sub rm_PickerResult (Success As Boolean, Uri As String)
Dim j As JavaObject
If Success Then
If Uri = "" Then
ToastMessageShow("Silent was chosen", True)
Else
Log(Uri)
AlarmURI = Uri 'save for later when call showringtonepicker, it will pre-select same sound
'rm.Play(Ur)
J = GetRingtoneObject(Uri)
J.RunMethod("play", Null)
Sleep(2000)
J.RunMethod("stop", Null)
End If
Else
Log("Error_URI: " & Uri)
ToastMessageShow("Error loading ringtone.", True) 'this will also trigger if user select same previous sound
End If
End Sub
Sub GetRingtoneObject(Url As String) As JavaObject
Dim jo As JavaObject
Dim Jo2 As JavaObject
Dim Ur As Uri
jo.InitializeStatic("android.media.RingtoneManager")
Jo2.InitializeContext
Ur.Parse(Url)
Return jo.RunMethodJO("getRingtone", Array(Jo2, Ur))
End Sub