Thursday, July 23, 2015

android: Splash Screen Example

public class SplashScreen extends Activity {

    private static int SPLASH_TIME_OUT = 2000; //2 second
    long waitingTime = 1 * 60 * 1000; // 1 min
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);  
        setContentView(R.layout.activity_splash);
    
        Handler handler = new Handler();       

        handler.postDelayed(new Runnable() {
            @Override            public void run() {
                //Do something after 2 second and must use finish();
              
                finish();             
            }
        }, SPLASH_TIME_OUT);//2 second    }
}

No comments:

Post a Comment