I prefer doing it without an Activity: create a style for the splash screen and set it as the main activity's style. Then, on the activity's onCreate, set the theme to the default theme and you're done. This immediately displays the splash screen (without that white screen that is sometimes displayed) and eliminates the need for an extra activity just to show the splash screen. However, it has the disadvantage of showing the splash screen again if you navigate to another activity and the main activity gets destroyed (for instance, due to resource constraints).
Regardless, since I've been using a single activity - multiple fragments architecture, the disadvantage doesn't really bother me :)
You can add references to animations in a theme. You could, for example, create an animation-list with the animation you want and set it as the theme's windowBackground.
I prefer doing it without an Activity: create a style for the splash screen and set it as the main activity's style. Then, on the activity's onCreate, set the theme to the default theme and you're done. This immediately displays the splash screen (without that white screen that is sometimes displayed) and eliminates the need for an extra activity just to show the splash screen. However, it has the disadvantage of showing the splash screen again if you navigate to another activity and the main activity gets destroyed (for instance, due to resource constraints).
Regardless, since I've been using a single activity - multiple fragments architecture, the disadvantage doesn't really bother me :)
Looks good because of your architecture but what if you wanna do an animation with the image? or something like that?
You can add references to animations in a theme. You could, for example, create an animation-list with the animation you want and set it as the theme's windowBackground.
can you show me the way in steps plz?
I have an example of this in a repo:
1 - Create the splash screen style like in github.com/rcosteira79/AndroidMult...
2 - Set it as the main activity's theme like in github.com/rcosteira79/AndroidMult...
3 - Reset the theme in the main activity like in github.com/rcosteira79/AndroidMult...
Thanks Ricardo, this works perfectly !