Sub Activity_KeyPress (KeyCode As Int) As Boolean 'Return True to consume the event
If KeyCode = KeyCodes.KEYCODE_VOLUME_DOWN Then
Dim PhoneVol As Phone
Dim temp As Int
temp = PhoneVol .GetVolume(PhoneVol .VOLUME_MUSIC)
If temp > 0 Then
temp = temp - 1
PhoneVol .SetVolume(PhoneVol .VOLUME_MUSIC, temp, True)
End If
End If
If KeyCode = KeyCodes.KEYCODE_VOLUME_UP Then
temp = PhoneVol.GetVolume(PhoneVol.VOLUME_MUSIC)
If temp < PhoneVol .GetMaxVolume(PhoneVol.VOLUME_MUSIC) Then
temp = temp + 1
PhoneVol .SetVolume(PhoneVol .VOLUME_MUSIC, temp, True)
End If
End If
End Sub