radityakurnianto

SplashScreenActivity

Jun 7th, 2013
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.94 KB | None | 0 0
  1. package com.otak3.goo;
  2.  
  3. import android.app.Activity;
  4. import android.content.Intent;
  5. import android.os.Bundle;
  6.  
  7. public class SplashScreenActivity extends Activity {
  8.      
  9.     /** Called when the activity is first created. */
  10.    
  11.     private long ms = 0;
  12.     private long splashTime = 5000;
  13.     private boolean splashActive = true;
  14.     private boolean splashPause = false;
  15.  
  16.     @Override
  17.    
  18.     public void onCreate(Bundle savedInstanceState) {
  19.         super.onCreate(savedInstanceState);
  20.         setContentView(R.layout.main1);
  21.  
  22.  
  23.         Thread th = new Thread(){
  24.            
  25.             public void run(){
  26.                 try { while (splashActive && ms < splashTime) {
  27.                    
  28.                     if (!splashPause){ ms = ms +100; } sleep(100); }
  29. }
  30.  
  31.             catch (Exception e) {
  32.                
  33.             } finally {
  34.                
  35. Intent i = new Intent(SplashScreenActivity.this,Splash2.class);
  36.  
  37. startActivity(i); } } };
  38.  
  39. th.start();
  40.  
  41. this.finish(); /*ini koding supaya activitynya finish() setelah manggil splash2*/
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment