Private Sub PlayDefaultClick
'moCaller is the "callback" object and may be an Activity or another class...
If moCaller <> Null Then
PlaySoundEffect(0) 'FX_KEY_CLICK
End If
End Sub
Private Sub PlayKeypressStandard
If moCaller <> Null Then
PlaySoundEffect(5) 'FX_KEYPRESS_STANDARD
End If
End Sub
Private Sub PlaySoundEffect(SoundEffectConstant As Int)
Dim am As JavaObject = GetContext.RunMethod("getSystemService", Array("audio"))
am.RunMethod("playSoundEffect", Array(SoundEffectConstant))
End Sub
Private Sub GetContext As JavaObject
Return GetBA.GetField("context")
End Sub
Private Sub GetBA As JavaObject
Dim jo As JavaObject
Dim cls As String = moCaller
cls = cls.SubString("class ".Length)
jo.InitializeStatic(cls) 'fails with "class not found" exception when moCaller is another class.
Return jo.GetFieldJO("processBA")
End Sub