Android button don't work after animation -


i use animation in button of android application.the first pressing working after button doesn't work. press , makes animation again listener don't work. here code. how can solve this?

private animation anim  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);      anim = animationutils.loadanimation(this, r.animator.but_anim);      button = (button) findviewbyid(r.id.button1);     button.setonclicklistener((android.view.view.onclicklistener) this); }   public void onclick(final view v) {     // todo auto-generated method stub     if(v.getid() == r.id.button1){          anim.setanimationlistener(new animationlistener() {             @override             public void onanimationstart(animation animation) {}              @override             public void onanimationrepeat(animation animation) {}              @override             public void onanimationend(animation animation) {                 //some code...             }         });          v.setanimation(anim);      } } 

you should try change: from:

v.setanimation(ocranimation); 

to:

v.startanimation(ocranimation); 

Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -