How to go to an anther activity after the end of a frame by frame android animation -
how start activity after animation has ended. have added android:oneshot="true" in xml how start new activity after animation has stopped.i have attached entire code below. please let me know how start new activity.if use code without showing animation goes acitivity.
public class mainactivity extends activity { imageview iv; protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); } public void onwindowfocuschanged (boolean hasfocus) { super.onwindowfocuschanged(hasfocus); animationdrawable animation = (animationdrawable) iv.getbackground(); if(hasfocus) { animation.start(); startactivity(new intent(mainactivity.this,second.class)); } else { animation.stop(); } } public void onstart() { { super.onstart(); iv = (imageview)findviewbyid(r.id.imageview1); iv.setbackgroundresource(r.animator.animation); } }
}
one way sure can use onanimationlistener
, , interested implementing onanimationend
method of listener interface.
something this:
animation.setanimationlistener(new animation.animationlistener() { @override public void onanimationstart(animation animation) { } @override public void onanimationend(animation animation) { startactivity(new intent(mainactivity.this,second.class)); } @override public void onanimationrepeat(animation animation) { } });
Comments
Post a Comment