Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim RM As RingtoneManager
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
RM.ShowRingtonePicker("RM",RM.TYPE_RINGTONE,True,"")
End Sub
Sub RM_PickerResult (Success As Boolean, Uri As String)
If Success Then
Dim R As Reflector
'Convert the selected Uri string to a Uri Object compatible with the getRingtone method.
Dim RTUri As Object = R.RunStaticMethod("android.net.Uri","parse",Array As Object(Uri),Array As String("java.lang.String"))
'Get the actual ringtone object from the Uri
R.Target = R.RunStaticMethod("android.media.RingtoneManager","getRingtone",Array As Object(R.GetContext,RTUri),Array As String("android.content.Context","android.net.Uri"))
'Get the title from the ringtone object
Dim Name As String = r.RunPublicmethod("getTitle",Array As Object(R.GetContext),Array As String("android.content.Context"))
'Silent returns Unknown ringtone
Log("RingToneName="&Name)
Else
Log("Pickerresult Error")
End If
End Sub