Change activity using the Gesture

0
public boolean onTouchEvent(MotionEvent touchevent){
    switch ((touchevent.getAction())){
        case MotionEvent.ACTION_DOWN:
        {
            x1=touchevent.getX();
            break;
        }
        case MotionEvent.ACTION_UP:
        {
            x2 = touchevent.getX();


            if (x1< x2){
                //Toast.makeText(this," izquierda a derecha",Toast.LENGTH_SHORT).show();
                Intent the = new Intent(getApplicationContext(),the_who.class);
                startActivity(the);


            }
            if (x1>x2){
                Toast.makeText(this,"derecha a izquierda",Toast.LENGTH_SHORT).show();
            }
            break;
        }
    }
    return false;
}
    
asked by ACamilo Oviedo Claros 30.11.2017 в 16:04
source

0 answers