Search code examples
androidanimationstartup

Android app start up animation


i just need to know how is it possible to create a start-up animation in your app. When the app is launched I would like it to go through custom animation and then it reaches the content of the app (main activity) ...

Thanks for all your help


Solution

  • If you really want a "startup" screen, just load up another activity before the MainActivity and display that screen for x amount of time:

    public class SplashScreen extends Activity {
    
        // Splash screen timer
        private static int TIME_OUT = 5000;
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.splash_layout);
    
            new Handler().postDelayed(new Runnable() {
    
                @Override
                public void run() {
                    Intent i = new Intent(SplashScreen.this, MainActivity.class);
                    startActivity(i);
                    finish();
                }
            }, TIME_OUT);
        }
    
    }