Created
November 28, 2015 02:10
-
-
Save anncode1/7ee57630dfbac66dda23 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Android Manifest | |
<activity | |
android:name="SplashScreenActivity" | |
android:launchMode="singleTask" > | |
<intent-filter> | |
<action android:name="android.intent.action.MAIN" /> | |
<category android:name="android.intent.category.LAUNCHER" /> | |
</intent-filter> | |
</activity> | |
<activity | |
android:name="MainActivity" | |
android:launchMode="singleTask" > | |
</activity> | |
SplashScreenActivity.java | |
private static final long SPLASH_SCREEN_DELAY = 4000; | |
TimerTask task = new TimerTask() { | |
@Override | |
public void run() { | |
// Start the next activity | |
Intent mainIntent = new Intent().setClass( | |
SplashScreenActivity.this, MainActivity.class); | |
startActivity(mainIntent); | |
// Close the activity so the user won't able to go back this | |
// activity pressing Back button | |
finish(); | |
} | |
}; | |
// Simulate a long loading process on application startup. | |
Timer timer = new Timer(); | |
timer.schedule(task, SPLASH_SCREEN_DELAY); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment