to use a splash screen in your android application you need two things -
- make a xml file which contains the designing part
- your logic part in java such as for how long you want to show your screen.
a sample of an XML file
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/back" />
<item>
<bitmap android:src="@drawable/logo"
android:gravity="center" />
</item>
</layer-list>
you Splash Activity can contain code
public class SplashActivity extends AppCompatActivity {
private static int SPLASH_TIME_OUT = 1000;
@Override
protected void onCreate(Bundle savedInstances){
super.onCreate(savedInstances);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
// This method will be executed once the timer is over
// Start your app main activity
Intent i = new Intent(getApplicationContext (), MainActivity.class);
startActivity(i);
// close this activity
finish();
}
}, SPLASH_TIME_OUT);
}
}
you need to make sure that you set your SplashActivty as launcher activity in your app manifest file.