title: How to close the application after animation?
body: <p>Hi i'm running an animation and after 2 seconds i want to stop it and close the whole application.</p>
  
  <p>This is my animation: </p>
  
  <pre><code>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();
                      }
                  });
  }
  </code></pre>
  
  <p>and i tried to use finish() after a timer was called - the application closed, but without any animations.</p>
  
  <p>Any Suggestions?</p>
  
  <p><strong>Edit:</strong></p>
  
  <pre><code>public void delay() {
      Timer timer = new Timer();
      try {
          synchronized(timer){
              timer.wait(2000);
              getParent().finish();
          }
      } catch (InterruptedException e) {
          e.printStackTrace();
      }
  }
  </code></pre>