Android Question Responding to Touch event within a class module

Discussion in 'Android Questions' started by Andrew Gray, Jul 11, 2015.

  1. Andrew Gray

    Andrew Gray Member Licensed User

    Hi,

    I need to handle a Panel Touch event within a class module, but Activity.ACTIVITY_DOWN, Activity.ACTION_MOVE and Activity.ACTION_UP don't work here.

    The values of these don't seem to be documented anywhere, but they appear to be 0 for down, 2 for move and 1 for up. Can I just hard-code these three constants into my class module? i.e. instead of testing if Action = Activity.ACTION_DOWN, test if Action = 0, etc.

    Or is there a better way of doing this?

    Andrew
     
  2. Jaames

    Jaames Active Member Licensed User

    Of course you can. Those are int constant values.

    But if you want you can define within the Class_Globals sub your own constant values, which are the same
    as the standard values.
    Code:
    Sub Class_Globals
        
    Dim Const ACTION_DOWN As Int  = 0
        
    Dim Const ACTION_UP As Int = 1
        
    Dim Const ACTION_MOVE As Int = 2
    ...
    The code is then much easier to read...
     
    Last edited: Jul 12, 2015
Loading...