title: How can I get wait/sleep to work the way I want in java?
body: <p>I'm trying to accomplish something very simple.  First, load my layout (main.xml).  Then wait 1 second, modify an image, wait 1 second and modify it to a third image.  (My end goal is more complex, of course, but I can't even get this to work).</p>
  
  <p>Basically, I get a black screen when the app loads. It stays that way until all the waiting is over, then it shows the final image.  Here's my code:</p>
  
  <pre><code>super.onCreate(savedInstanceState);
  setContentView(R.layout.main);        
  
  ImageCard[0] = (ImageView)findViewById(R.id.imageView11);
  Thread.sleep(1000);
  ImageCard[0].setImageDrawable(getResources().getDrawable(R.drawable.secondimage));
  Thread.sleep(1000);
  ImageCard[0].setImageDrawable(getResources().getDrawable(R.drawable.thirdimage));
  </code></pre>
  
  <p>ImageCard[0] is the image I'm trying to change.  It loads in main.xml and shows fine if I remove the rest of the code.</p>
  
  <p>If I change the sleep time to 5000, it then takes 10 seconds before it finally comes away from the black screen and shows the third image.  This is how I know it's not just loading slow, but that it's actually waiting.</p>
  
  <p>It's like it's not running sequentially.  I'm no java expert, so I'm assuming I'm doing something dumb...</p>
  
  <p>Thanks for any help!</p>