[Solved] Showing logo 3 seconds before loading mainActivity [duplicate]


I think what you’re referring is how to implement a Splash screen,

Create a new empty activity, I’ll call it Splash for this example;

public class SplashScreen extends Activity {

    // Sets splash screen time in miliseconds
    private static int SPLASH_TIME = 3000;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);

        new Handler().postDelayed(new Runnable() {


            @Override
            public void run() {

                // run() method will be executed when 3 seconds have passed

                //Time to start MainActivity
                Intent intent = new Intent(Splash.this, MainActivity.class);
                startActivity(intent );

                finish();
            }
        }, SPLASH_TIME);
    }

}

Make sure you’ve set Splash activity as the launcher activity in your Manifest file :

 <activity
     android:name=".Splash"
     android:theme="@android:style/Theme.NoTitleBar">
       <intent-filter>

            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />

       </intent-filter>
</activity>

solved Showing logo 3 seconds before loading mainActivity [duplicate]