to stop animation when touch event is released


Last Updated:

  1. Yati

    Yati New Member This Topic's Starter

    Joined:
    Mar 24, 2010
    Messages:
    4
    Likes Received:
    0
    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

    Joined:
    Sep 5, 2011
    Messages:
    12
    Likes Received:
    2
    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...