I'm in the process of making an app that slides facts across the screen left and right, my issue is that I cannot find a default class to do this, instead a VERY SIMPLE action that is commonly used needs this:
public boolean onTouchEvent(MotionEvent event)
{
switch(event.getAction())
{
case MotionEvent.ACTION_DOWN:
x1 = event.getX();
break;
case MotionEvent.ACTION_UP:
x2 = event.getX();
float deltaX = x2 - x1;
if (Math.abs(deltaX) > MIN_DISTANCE)
{
Toast.makeText(this, "left2right swipe", Toast.LENGTH_SHORT).show ();
}
else
{
// consider as something else - a screen tap for example
}
break;
}
return super.onTouchEvent(event);
}
or something equally as difficult and foreign for a BASIC MOVEMENT.
Is there an easier way? I find unacceptable for an SDK of such a massive OS to not have a default class to handle this, especially since there's an 'ACTION_' for just about everything except left and right.