Android Splash screen is a UI that is displayed in any android application just before the main UI is displayed. There are different purposes for which we use this screen. In general, we use it for the following purposes.
For example: Download and store data in the database, download required images, parse Json/xml file, send device information and register the device to the server.
You will see white(blank) screen in this duration. Finally, display the splash screen until the main layout of your application is inflated. We can use the logo of our application as a splash screen.
Now-a-days, for any reason (mentioned above) people use android splash screen. So, we're going to use android splash screen.
Hey, Developers ! In this tutorial we will see how to use Android SplashScreen in any android application.
Unfortunately, compared to IOS, there is no built-in mechanism for implementing android splash screen in android apps. So, using activity, we will implement splash screen.
Let's start the tutorial with the creation of new project and the implementation of basic materials. After that, we will start implementing splash screen.
At first, we will create android application. Then, we will see how to build SplashScreen in the application.
Follow steps below to create new project. Please ignore the steps if you have already created a new application.
S. No. | Steps |
1 | Open Android Studio. |
2 | Click on Start a new Android Studio Project then choose your project and select Empty Activity. |
3 | Write application name as SplashScreen after this write a package name you can write your own package name. |
4 | Select language Java. Select minimum SDK you need. However, we have selected 17 as minimum SDK. Then, click next button. |
5 | If you have followed above process correctly, you will get a newly created project successfully. However, you can also visit tutorial to Create a New Project to know steps in detail. |
Create an activity_splash.xml file in res=>layout folder. And include the following code.
Create an SplashScreenActivity.java file in com.ukacademe.splashscreen. And include the following code.
Now in styles.xml file we added windowActionBar ="false" & windowNoTitle = "true" to hide the ActionBar and and windowTitle to show the splashscreen in full display.
Note : Its only for splash screen we don't want ActionBar and Title in SplashScreen but we need this both in our main activity or in other activity for that we need to add one more theme for our other activities. So include the following code into your styles.xml file.
Now, the last step is in AndroidManifest.xml file here we can define our SplashScreenActivity.java file and MainActivity. So include the following code into your AndroidManifest.xml file.
Congratulations! your SplashScreen App is completed just run it on your device or in emulator.
We use cookies to ensure you get the best experience on our website, if you continue to browse you'll be acconsent with our Cookies Policy.
Got it!