title: How to start an activity after certain time period?
body: <p>i need to start an activity from the current activity after a certain time period. I coded like below.</p>
  
  <pre><code>public class FirstActivity extends Activity {
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_first);
  
  
      new Timer().schedule(new TimerTask(){
          public void run() { 
              startActivity(new Intent(FirstActivity.this, SecondActivity.class));
          }
      }, 2000); 
  }
  </code></pre>
  
  <p>But its not working..it keeps on crashing..  Is my method correct? my manifest file is as below</p>
  
  <p>`</p>
  
  <pre><code>&lt;uses-sdk
      android:minSdkVersion="8"
      android:targetSdkVersion="15" /&gt;
  
  &lt;application
      android:icon="@drawable/ic_launcher"
      android:label="@string/app_name"
      android:theme="@style/AppTheme" &gt;
      &lt;activity
          android:name=".FirstActivity"
          android:label="@string/title_activity_first" &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=".SecondActivity"
          android:label="@string/title_activity_second" &gt;
          &lt;meta-data
              android:name="android.support.PARENT_ACTIVITY"
              android:value="com.example.first.FirstActivity" /&gt;
      &lt;/activity&gt;
  &lt;/application&gt;
  </code></pre>
  
  <p></p>