Skip to main content

Splash Screens : Doing It The Right Way !


An Android application takes a little amount of time to start up , especially during the cold start i.e. the first time it runs on the device.

The very idea of splash screen irritates me. I mean they just waste your time and show you a highly crafted logo. As an Android Developer, just kidding I am just a beginner, when I see splash screen I just imagine that some poor developer had to add a three second delay to the code, just under the society's pressure.

Every time I open an application I have to just stare to a random picture for 3 seconds without any reason. I mean I just know which application I have opened and what it does, just let me use the app.

According to the Google Recommendation :

Google advocates that one should use a Splash Screen according to the Material Design Specs.
It’s still not a good idea to use a splash screen that wastes a user’s time. Please don’t do that.

Doing It The Right Way! :

However Android app do take some time to start up , especially on a cold start. There is a delay that you may not able to avoid . Instead of just leaving the blank screen why not just show user something nice. This is the approach Google is advocating. Don't waste user's time , but also don't show them blank  section of the app, the first time it loads.

If you look at recent updates to Google apps, you’ll see appropriate uses of the splash screen. Take a look at the YouTube app, for example.





The amount of time you just spent looking the splash screen was just the time it took to configure the application.This is on a cold launch, too, which means this is the slowest launch possible. If the app is cached, the splash screen will go away almost immediately.

Implementing Splash Screen:


Implementing a splash screen the right way is a little different than you might imagine. Its not like loading an activity and add a 3 second delay and then load the Main/Home activity. The splash view that you see has to be ready immediately, even before you can inflate a layout file in your splash activity.

So you will not use a layout file. Instead, specify your splash screen’s background as the activity’s theme background. To do this, first create an XML drawable in res/drawable.



Here, I’ve set up a background image.

Next, I will set this as my splash activity’s background in the theme. Now just navigate to your styles.xml file and add a new theme for your splash activity:





 In your new SplashScreen, set the window background attribute to your XML drawable. Configure this as your splash activity’s theme in your AndroidManifest.xml:





Finally, MainActivity (which is supposed to be SplashActivity) class should just forward you along to your main activity:








Notice that you don’t even set up a view for this MainActivity. The view comes from the theme. When you set up the UI for your splash activity in the theme, it is available immediately.

If you did have a layout file for your splash activity, that layout file would be visible to the user only after your app has been fully initialized, which is too late. You want the splash to be displayed only in that small amount of time before the app is initialized.


Armed with this knowledge, make your splash screen work the right way. Don’t waste the user’s time, but give them something nice to look at while they wait.






Comments

Popular posts from this blog

BHIM app launched

Gearing up the move towards Digital India , Prime Minister Narendra Modi recently launched e-wallet app  BHIM( Bharat Interface for Money ) ,  which is named after Dr B.R. Ambedkar according to the sources. PM Narendra Modi mentioned that BHIM app is launched for making transactions more easy and reliable. BHIM is Aadhaar  based mobile payment service through which various transactions can be done. The app BHIM was launched at Digi Dhan Mela which was held in Delhi. It is basically refurbished version of UPI (Unified Payments Interface) and USSD (Unstructured Supplementary Service Data) This service can be used on a smartphone or a regular basic feature phone . At present it is available on Play Store for Android Devices , later it will be available on App Store also for iOS devices ( Can't say anything about Windows Phone 😋 ). To use BHIM one needs to register their respective account with the app and generate UPI code for further transactions . T...

10 Major Android O features !

Google is surely coming out with its new high-calorie name for Android O, mean while techies are thinking about the possibilities for O....... Google could come ahead with Oreo, Orange, Oatcake.(Most probably Oreo) The very first developer preview of android O is out now,  ahead of its annual Google I/O developer's conference  and like every other update of Android I am excited.While I don't know what Android O will be called , but I do know about all the features that Android O will bring. Google could come ahead with Oreo, Orange, Oatcake.(Most probably Oreo) So here are 10 cool Android O features that you should definitely know. Improved Notification The first Android O feature I'm going to talk about is the improved notifications. Google has been refining the notification center since Lollipop and they are not done yet . Android O brings notification channel which lets you customize notifications for different categories of an app. Let...

Windows 10 Tricks & Hidden Features !

Today I’m going to share some windows 10 tricks and tricks that are fairly unknown. So without any further ado let’s get started. Dynamic Lock There are situations when u get up from your desk to grab a cup of coffee, but you forget to lock your Laptop. Well you won’t want anyone to take a peek in your laptop. Would you? Well this is where the cool new Dynamic Lock feature comes into play. Dynamic lock automatically locks your PC when you are away. To enable it you first have to pair your phone with your PC via Bluetooth. Then you can just head to Settings and go to Accounts and then go to Sign-in options. Here scroll down below and check the option below Dynamic Lock. Now whenever you move away from your Laptop with your phone. Your laptop will automatically be locked, when your phone is out of the Laptop’s Bluetooth range. Do note this feature might only be available only on Windows 10 Creators Update. Free Up Storage If u have a high end Windo...