title: Unable to implement sleep() properly
body: <p>I was trying to make a very simple app which has a splash screen leading to the main activity. Can someone please point out why the splash screen's sleep continues indefinitely? 
  If I remove the sleep functionality, the app works properly. </p>
  
  <p>Splash class:</p>
  
  <pre><code>package com.example.myfirstapp.app;
  
  import android.app.Activity;
  import android.content.Intent;
  import android.os.Bundle;
  
  public class Splash extends Activity {
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.splash);
      Thread timer = new Thread(){
          @Override
          public void run() {
              super.run();
              try {
                  sleep(1000);
              } catch (InterruptedException e) {
                  e.printStackTrace();
              } finally {
                  Intent open = new Intent("android.intent.action.MAINACTIVITY");
                  startActivity(open);
  
              }
  
  
          }
      };
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Manifest: </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>&lt;application
      android:allowBackup="true"
      android:icon="@drawable/ic_launcher"
      android:label="@string/app_name"
      android:theme="@style/AppTheme" &gt;
      &lt;activity
          android:name="com.example.myfirstapp.app.Splash"
          android:label="@string/app_name" &gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN" /&gt;
  
              &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
  
      &lt;activity
          android:name="com.example.myfirstapp.app.MainActivity"
          android:label="@string/app_name" &gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAINACTIVITY" /&gt;
  
              &lt;category android:name="android.intent.category.DEFAULT" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
  
  
  &lt;/application&gt;
  </code></pre>
  
  <p></p>