title: Is this a good approach for android fade animation?
body: <p>I'm just starting out with android development and I want to implement an ImageView which fades out, changes the image and fades back in. This snippet of code is working as intended right now, but I'm curious if it's a good approach to the problem.</p>
  <pre><code>(new Thread(){
              @Override
              public void run() {
                  runOnUiThread(new Runnable() {
                      @Override
                      public void run() {
                          imageView.animate().alpha(0).setDuration(1000);
                      }
                  });
                  try{
                      Thread.sleep(1000);
                  }catch(InterruptedException e){
                      Log.i(&quot;Ooopsie&quot;,&quot;Hey...Uhm i was kinda interrupted&quot;);
                  }
                  runOnUiThread(new Runnable() {
                      @Override
                      public void run() {
                          if(bart){
                              imageView.setImageDrawable(getDrawable(R.drawable.homer));
                          }else{
                              imageView.setImageDrawable(getDrawable(R.drawable.bart));
                          }
                          bart=!bart;
                          imageView.animate().alpha(1).setDuration(2000);
                      }
                  });
  
              }
          }).start();
  </code></pre>