
- Forum posts: 1
Mar 15, 2016, 11:28:09 AM via Website
Mar 15, 2016 11:28:09 AM via Website
hi
i have a problem with detecting a swipe
i'm working on a calculator using visual studio and i want to give the user the ability to change
between activity using a swipe
here is the code
public override bool OnTouchEvent(MotionEvent e)
{
int action = (int)e.Action;
switch (action)
{
case (int)MotionEventActions.Down:
x1 = e.GetX();
y1 = e.GetY();
break;
case (int)MotionEventActions.Up:
x2 = e.GetX();
y2 = e.GetY();
break;
}
if (x1 < x2)
{
StartActivity(typeof(MainActivity));
}
return true;
}
it works fine on the text view but when i swipe over the buttons
it doesn't work
hope someone could help me out and thanks in advance