Cara Mambut Splash Screen di Android

oi oi ketemu lagi sama gue danang ganteng a.k.a dananx papayas :3… wah lama ga ngeblog lagi gara” ane lagi UNAS.. doain semoga UNAS ane dapet yang terbaik lah :D… oiye ane sekarang mau share nih caranya bikin splash screen di android
langsung aja deh ya gak usah panjang lebar :3


1. Create New Project

2. Buat Class SplashScreenActivity.java

1:  package dananx.papayas;  
2:  import android.app.Activity;  
3:  import android.content.Intent;  
4:  import android.os.Bundle;  
5:  import android.view.MotionEvent;  
6:  public class SplashScreenActivity extends Activity {  
7:    protected boolean _active = true;  
8:    protected int _splashTime = 5000;  
9:    /** Called when the activity is first created. */  
10:    @Override  
11:    public void onCreate(Bundle savedInstanceState) {  
12:      super.onCreate(savedInstanceState);  
13:      setContentView(R.layout.splash);  
14:      // thread for displaying the SplashScreen  
15:      Thread splashTread = new Thread() {  
16:        @Override  
17:        public void run() {  
18:          try {  
19:            int waited = 0;  
20:            while(_active && (waited < _splashTime)) {  
21:              sleep(100);  
22:              if(_active) {  
23:                waited += 100;  
24:              }  
25:            }  
26:          } catch(InterruptedException e) {  
27:            // do nothing  
28:          } finally {  
29:            finish();  
30:            Intent newIntent=new Intent(SplashScreenActivity.this,SplashActivity.class);  
31:                  startActivityForResult(newIntent,0);  
32:          }  
33:        }  
34:      };  
35:      splashTread.start();  
36:    }  
37:    @Override  
38:    public boolean onTouchEvent(MotionEvent event) {  
39:      if (event.getAction() == MotionEvent.ACTION_DOWN) {  
40:        _active = false;  
41:      }  
42:      return true;  
43:    }  
44:  }  

dan jangan lupa buat class lain yang akan ditujušŸ˜€
dan run deh aplikasi nya

link donlot !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s