Back to project page digitalcampus.
The source code is released under:
MIT License
If you think the Android project digitalcampus listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.llenguatges.digitalcampus.splash; //w ww. j a v a 2 s . c om import java.util.Timer; import java.util.TimerTask; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import com.llenguatges.digitalcampus.MainActivity; import com.llenguatges.digitalcampus.R; import com.llenguatges.digitalcampus.login.LoginActivity; import com.llenguatges.digitalcampus.login.SessionManager; public class SplashScreenActivity extends Activity { private long splashDelay = 2000; /** * Called when the activity is first created. * This is where you all of static set up: customize ActionBar. * This method also provides you with a Bundle containing the * activity's previously frozen state, if there was one. */ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash_screen); TimerTask task = new TimerTask() { /** * Starts executing the active part of the class' code. */ public void run() { SessionManager session = new SessionManager(getApplicationContext()); if(session.isLoggedIn()){ Intent mainIntent = new Intent().setClass(SplashScreenActivity.this, MainActivity.class); startActivity(mainIntent); finish(); }else{ Intent mainIntent = new Intent().setClass(SplashScreenActivity.this, LoginActivity.class); startActivity(mainIntent); finish(); } finish(); } }; Timer timer = new Timer(); timer.schedule(task, splashDelay); } }