Skip to content Skip to sidebar Skip to footer

Genericmotion - Action Down Not Firing

I want to trace the whole movement of a finger that started by touching my ImageView. I found that GenericMotion event should be the correct one to use. What am I supposed to do (o

Solution 1:

GenericMotion can not detect the gesture of your finger. I think it is only used to report for movement event. You can refer to the document here.

For example , You can move your imageview from top to bottom then the GenericMotion can detect the "move" action.

If you want to detect your finger event I think you can achieve OnTouchListener.

For example:

imgview.SetOnTouchListener(new MyTouchListener());

achieve MyTouchListener:

publicclassMyTouchListener: Java.Lang.Object, View.IOnTouchListener
{
    public bool OnTouch(View v, MotionEvent e)
    {
        throw new NotImplementedException();
    }

    public bool OnTouchEvent(View v, MotionEvent e)
    {
        if (e.Action == MotionEventActions.Down)
        {
            Log.Debug("Mike", "Down");
            Console.WriteLine("Down");
            returntrue;
        }
        if (e.Action == MotionEventActions.Up)
        {
            Log.Debug("Mike", "Up");
            Console.WriteLine("Up");
            returntrue;
        }
        if (e.Action == MotionEventActions.Move)
        {
            Log.Debug("Mike", "Move");
            Console.WriteLine("Move");
            returntrue;
        }

        returnfalse;
    }
}

Also you can achieve IOnGestureListener to detect your gesture.

Post a Comment for "Genericmotion - Action Down Not Firing"