How to Create Splash Screen for Android App

16 April 2016
16 April 2016, Comments Comments Off on How to Create Splash Screen for Android App

To create splash screen project for your android app, copy and paste the codes below to your project to create one of amazing splash screen project.

Open the android studio, create New Project and give Application Name ‘SplashScreen’ to it.

Leave the activity name as by default ‘MainActivity’ and hit the finish button to build the project.

Now create new Java Class under Java folder by right clicking on your package name > New > Java Class. We can give name ‘ SplashScreen.java’ to it. Copy & paste following code.

SplashScreen.java

Similarly, create xml file under res folder by right clicking on layout > New > Layout resource file. We can give name ‘splash.xml’ to it. Copy & paste following code.

splash.xml

Make sure you have put an image in your drawable folder & image name should be ‘your_image’ as we mentioned in xml file.

In AndroidManifest.xml, we have to add both activities SplashScreen.java & splash.xml by which our splash screen would be appear before MainActivity (Home Screen). After adding some codes, AndroidManifest.xml will be,

AndroidManifest.xml

Keep in mind that MainActivity.java & activity_main.xml will not be modified. So leave both as it is by default. For precaution, coding will looks as following

MainActivity.java

activity_main.xml

That’s it, now run your app & Insha-Allah you will see a splash screen of few seconds showing an image before launching home screen. Your project about splash screen has been successfully completed once if you followed our above steps.