Splash screen is an activity that will show for set time when your app is starting and after set time period redirect to application main screen.
Example :
Lets splash screen show set time is 15 sec then in mean time when splash screen showing you can do these tasks...
1. You can download resources(images) from webserver to your phone.
2. You can make server call and get data from server.
3. Get data from network and save in database.
4. Show something about your app/company/brand on Splash screen.
Project Structure:
Some Experts says :
                
Example :
Lets splash screen show set time is 15 sec then in mean time when splash screen showing you can do these tasks...
1. You can download resources(images) from webserver to your phone.
2. You can make server call and get data from server.
3. Get data from network and save in database.
4. Show something about your app/company/brand on Splash screen.
Project Structure:
File : src/MainActivity.java
Showing two methods to create splash screen ....
METHOD 1: Create a thread and set time to sleep after that redirect to main app screen.
METHOD 2: Set time to handler and call Handler().postDelayed , it will call run method of runnable after set time and redirect to main app screen.
METHOD 1: Create a thread and set time to sleep after that redirect to main app screen.
METHOD 2: Set time to handler and call Handler().postDelayed , it will call run method of runnable after set time and redirect to main app screen.
package com.example.splashscreen;import android.os.Bundle;import android.os.Handler;import android.app.Activity;import android.content.Intent;import android.view.Menu;public class MainSplashScreen extends Activity {    @Override    protected void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentView(R.layout.activity_main);         // METHOD 1                       /****** Create Thread that will sleep for 5 seconds *************/                Thread background = new Thread() {            public void run() {                                 try {                    // Thread will sleep for 5 seconds                    sleep(5*1000);                                         // After 5 seconds redirect to another intent                    Intent i=new Intent(getBaseContext(),NextScreen.class);                    startActivity(i);                                         //Remove activity                    finish();                                     } catch (Exception e) {                                 }            }        };                 // start thread        background.start();//METHOD 2  
         
        /*
        new Handler().postDelayed(new Runnable() {
              
            // Using handler with postDelayed called runnable run method
  
            @Override
            public void run() {
                Intent i = new Intent(MainSplashScreen.this, NextScreen.class);
                startActivity(i);
  
                // close this activity
                finish();
            }
        }, 5*1000); // wait for 5 seconds
        */
    }
     
    @Override
    protected void onDestroy() {
         
        super.onDestroy();
         
    }
}
 File : src/NextScreen.java
Splash screen will redirect to this screen.
package com.example.splashscreen;import android.app.Activity;import android.os.Bundle;public class FirstScreen extends Activity {         @Override    public void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentView(R.layout.nextscreen);              }          @Override    protected void onDestroy() {                 super.onDestroy();             }}- A splash screen prevents the user from using the application.
- Most of the time, it is not necessary.
- Adding once viewed images increase the size of your APKs.
- Users don’t care about branding at launch time.
|  | 
| Welcome Screen | 
|  | 
| Second Screen | 

