I wanted to make my app look more professional, so I decided that I wanted to make a splash screen.
How would I create it and then implement it?
Note this solution will not let the user wait more: the delay of the splash screen depends on the start up time of the application.
When you open any android app you will get by default a some what black screen with the title and icon of the app on top, you can change that by using a style/theme.
First, create a style.xml in values folder and add a style to it.
<style name="splashScreenTheme" parent="@android:style/Theme.DeviceDefault.Light.NoActionBar">
<item name="android:windowBackground">@drawable/splash_screen</item>
</style>
Instead of using @android:style/Theme.DeviceDefault.Light.NoActionBar
you can use any other theme as a parent.
Second, in your app Manifest.xml add android:theme="@style/splashScreenTheme"
to your main activity.
<activity
android:name="MainActivity"
android:label="@string/app_name"
android:theme="@style/splashScreenTheme" >
Third, Update your theme in your onCreate() launch activity.
protected void onCreate(Bundle savedInstanceState) {
// Make sure this is before calling super.onCreate
setTheme(R.style.mainAppTheme);
super.onCreate(savedInstanceState);
}
UPDATE Check out this post.
Thanks to @mat1h and @adelriosantiago