With the latest updates to Trip O Meter (codenamed Balanjar - Version 2.0), the app startup time has increased a bit.
While I was not able to dig into the exact reason for the slowness, I thought about adding a Splash Screen while the app is loading.
From my research, there are multiple ways to create a Splash Screen ranging from new Activity for splash which is displayed for a fixed time to the simple approach detailed below.
We create a Splash layout which defines the content of the Splash screen.
Next a new style is created with
Now set this style as the style for the Launcher Activity
Once the Activity is loaded, we would set the style of the Activity back to the default style.
R.style.AppTheme_NoActionBar in this case represents the style
R.style.AppTheme.NoActionBar. Just make sure this is called before calling
That’s it, the contents of splash.xml will be displayed instead of the blank white screen before the application launches. This is a good place to show the app’s branding.