android - ontouch on frame by frame animation -


how implement on touch on image view used frame frame animation... using follow

 final animationdrawable newtonanimation = (animationdrawable) animation.getbackground();             animationstart(newtonanimation);              animation.setontouchlistener(l);   public void animationstart(final animationdrawable newanimation){     thread timer=new thread(){         @override         public void run(){                             try{                                     sleep(40);                                 }catch(exception e){}                                 finally{                                             newton_lawsactivity.this.runonuithread(new runnable() {                                                 public void run(){                                                 newanimation.start();                                             }});                                         }                             }                         };     timer.start();   

} getting ontouch event .......

public boolean ontouch(view v, motionevent event) {         // todo auto-generated method stub         log.w("debug","nullis event"+event+"or"+gesturedetector.ontouchevent(event));          return gesturedetector.ontouchevent(event); } 

set ontouch lintener below

             animation.setontouchlistener(new ontouchlistener()                 {                     @override                     public boolean ontouch(view v, motionevent event)                     {                         newtonanimation.stop();                          toast.maketext(frameanimationactivity.this, "animation stoped", toast.length_long).show();                         return false;                     }             }); 

Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -