How do you start an activity for a few seconds and then start another activity. I tried this code,when I try the app, it directly starts my MainActivity:
Thread timer=new Thread() {
public void run() {
try {
sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
}
Intent intent = new Intent("app.my.com.newapp.MAINACTIVITY");
startActivity(intent);
}
};
timer.start();
And here its my manifest file.
<?xml version="1.0" encoding="utf-8"?>
<supports-screens
android:anyDensity="true"
android:largeScreens="true"
android:normalScreens="true"
android:resizeable="true"
android:smallScreens="true" />
<application
android:allowBackup="true"
android:icon="@drawable/danger"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Introduction"
android:label="@string/title_activity_introduction">
<intent-filter>
<action android:name="app.my.com.newapp.MAINACTIVITY"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
</application>
Please help me out!!