TeguhSobari

Splash Screen

Jun 19th, 2016
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.01 KB | None | 0 0
  1.  
  2. import android.app.Activity;
  3. import android.content.Intent;
  4. import android.os.Bundle;
  5. import android.os.Handler;
  6.  
  7. /**
  8.  * Created by SAMSUNG on 19/06/2016.
  9.  */
  10. public class Splash extends Activity{
  11.     private static int SPLASH_TIME_OUT = 3000;
  12.  
  13.     @Override
  14.     protected void onCreate(Bundle savedInstanceState) {
  15.         super.onCreate(savedInstanceState);
  16.         setContentView(R.layout.activity_splash);
  17.         new Handler().postDelayed(new Runnable() {
  18.  
  19.             /*
  20.              * Showing splash screen with a timer. This will be useful when you
  21.              * want to show case your app logo / company
  22.              */
  23.  
  24.             @Override
  25.             public void run() {
  26.                 // This method will be executed once the timer is over
  27.                 // Start your app main activity
  28.                 Intent i = new Intent(Splash.this, MainActivity.class);
  29.                 startActivity(i);
  30.  
  31.                 // close this activity
  32.                 finish();
  33.             }
  34.         }, SPLASH_TIME_OUT);
  35.     }
  36. }
Add Comment
Please, Sign In to add comment