Brahim Cedrati
- 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
Recommended editorial content
With your consent, external content is loaded here.
By clicking on the button above, you agree that external content may be displayed to you. Personal data may be transmitted to third-party providers in the process. You can find more information about this in our Privacy Policy.