Hi i'm running an animation and after 2 seconds i want to stop it and close the whole application.
This is my animation:
public void onImageButtonOkClick(View view) {
setContentView(R.layout.success);
final ImageView mAnimLogo = (ImageView) findViewById(R.id.loading_image);
final AnimationDrawable mAnimation = (AnimationDrawable) mAnimLogo.getDrawable();
mAnimLogo.post(new Runnable() {
@Override
public void run() {
mAnimLogo.setVisibility(View.VISIBLE);
mAnimation.start();
}
});
}
and i tried to use finish() after a timer was called - the application closed, but without any animations.
Any Suggestions?
Edit:
public void delay() {
Timer timer = new Timer();
try {
synchronized(timer){
timer.wait(2000);
getParent().finish();
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}