KeyPress KeyCodes event question

abdulla

Member
Licensed User
Longtime User
I have a question regarding KeyCodes , i use KeyPress event to trigger an action such as recording from the MIC such as when volume key up is pressed recording from mic would start , But when i need to stop the recording , there does not seems to be a way to find out if the volume key was released, if the volume key released i would do stop recording , i looked at Activity_KeyPress and that it get executed when key is pressed as True Boolean , but if my thinking correct that if the Boolean value goes False that mean the Key is released ? if so how can i catch that value to let it do an action such is execute stop recording sub routine, the following code shows how to use the KeyCodes once Volume Key Up is pressed , How can i catch it Once the Volume Key Up is released to execute stop recording


Sub Activity_KeyPress(KeyCode As Int) As Boolean

If KeyCode = KeyCodes.KEYCODE_VOLUME_UP
' put code here to start recording
Return True
End If

End Sub


I would appreciate any help
 

abdulla

Member
Licensed User
Longtime User
I appreciate it , thanks for your help, i looked at the documentation and i found the details then i did this ,

Sub Activity_KeyUp (KeyCode As Int) As Boolean
If KeyCode = KeyCodes.KEYCODE_VOLUME_UP Then
etxt.Text = "Volume key up released " & KeyCode
End If
End Sub

And It Worked , Great.
 
Upvote 0
Top