Android Code Snippet cKeyCodes

Discussion in 'Code Snippets' started by Robert Valentino, Mar 25, 2015.

  1. Robert Valentino

    Robert Valentino Well-Known Member Licensed User

    I got tired of looking up the value for KeyCode when pressed so I wrote a class cKeyCodes

    Hope this saves someone sometime not having to look up the code values


    Code:
    Sub Process_Globals
           
    Public  KeyCodesDescriptions                                 As cKeyCodes
    end sub

    Sub Activity_Create(FirstTime As Boolean)
            KeyCodesDescriptions.Initialize
    End Sub


    Public Sub KeyPress(KeyCode As Int) As Boolean


       
    ToastMessageShow("KeyCodes:" &KeyCodesDescriptions.GetSKDKeyCode(KeyCode), False)

        
    If KeyCode = KeyCodes.KEYCODE_MEDIA_STOP Then
           
    Return False
        
    End If

        
    If KeyCode = KeyCodes.KEYCODE_POWER Then Log("PowerButton")
    End Sub
    Realized I posted the WRONG ToastMessageShow. Sometimes I am such a Bozo
     

    Attached Files:

    Last edited: Mar 30, 2015
  2. Reviewnow

    Reviewnow Active Member Licensed User

    Nice , Thanks could be very useful
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice