ub Activity_KeyPress( KeyCode As Int ) As Boolean 'Return True to consume the event
Dim result, cv, mv, nv, vc As Int
'vc = ph.VOLUME_ALARM ' Alarms channel
vc = Starter.ph.VOLUME_MUSIC ' Music channel ===> Beep uses Music channel
'vc = ph.VOLUME_NOTIFICATION ' Notifications channel
'vc = ph.VOLUME_RING ' Phone ring channel
'vc = ph.VOLUME_SYSTEM ' System sounds channel
'vc = ph.VOLUME_VOICE_CALL ' Voice calls channel
If KeyCode = 4 Then ' Exit key
result = Msgbox2( "QUIT?", "MyApp", "YES", "", "NO", Null)
If result = DialogResponse.POSITIVE Then Return False
Else If KeyCode = KeyCodes.KEYCODE_VOLUME_UP Then
mv = Starter.ph.GetMaxVolume( vc )
cv = Starter.ph.GetVolume( vc )
nv = cv + 1
If nv>mv Then nv = mv
Starter.ph.SetVolume( vc, nv, True )
else If KeyCode = KeyCodes.KEYCODE_VOLUME_DOWN Then
mv = Starter.ph.GetMaxVolume( vc )
cv = Starter.ph.GetVolume( vc )
nv = cv - 1
If nv<0 Then nv = 0
Starter.ph.SetVolume( vc, nv, True )
End If
Return True
End Sub ' Activity_KeyPress