to stop animation when touch event is released

Discussion in 'Application Development' started by Yati, Apr 1, 2010.

  1. Yati

    Yati New Member
    5

    Mar 24, 2010
    4
    0
    5
    Hi,
    I am very new to this forum i am sorry if i will be a bit confusing.
    I am using frame animation when my animation starts perfectly,
    when i try to use(i.e MotionEvent.ACTION_MOVE) it drags my
    rectangle as i want but my problem is that it does not stop the
    flickering as soon as i release my touch event i want it to stop
    flickering but it still continues with it.
    Please help me with it.
    Thanks
     

    Advertisement

  2. Pabrick

    Pabrick Member
    36

    Sep 5, 2011
    12
    2
    36
    Have you tried this?

    public boolean onTouch(View v, MotionEvent evento) {
    if(evento.getAction() == MotionEvent.ACTION_DOWN){
    your_anim.start();
    }else if (evento.getAction() == MotionEvent.ACTION_UP) {
    your_anim.stop();
    }
    return true;
    }//onTouch
     
    alostpacket likes this.

Share This Page

Loading...