SplashScreen | API reference | Android Developers (original) (raw)
public interface SplashScreen
``
android.window.SplashScreen
The interface that apps use to talk to the splash screen.
Each splash screen instance is bound to a particular [Activity](/reference/android/app/Activity). To obtain a [SplashScreen](/reference/android/window/SplashScreen) for an Activity, useActivity.getSplashScreen() to get the SplashScreen.
Summary
| Nested classes | |
|---|---|
| interface | SplashScreen.OnExitAnimationListener Listens for the splash screen exit event. |
| Constants | |
|---|---|
| int | SPLASH_SCREEN_STYLE_ICON Flag to be used with ActivityOptions.setSplashScreenStyle, to show the splash screen icon of the launched activity. |
| int | SPLASH_SCREEN_STYLE_SOLID_COLOR Flag to be used with ActivityOptions.setSplashScreenStyle, to avoid showing the splash screen icon of the launched activity |
| Public methods | |
|---|---|
| abstract void | clearOnExitAnimationListener() Clear exist listener |
| abstract void | setOnExitAnimationListener(SplashScreen.OnExitAnimationListener listener) Specifies whether an Activity wants to handle the splash screen animation on its own. |
| abstract void | setSplashScreenTheme(int themeId) Overrides the theme used for the SplashScreens of this application. |
Constants
SPLASH_SCREEN_STYLE_ICON
public static final int SPLASH_SCREEN_STYLE_ICON
Flag to be used with [ActivityOptions.setSplashScreenStyle](/reference/android/app/ActivityOptions#setSplashScreenStyle%28int%29), to show the splash screen icon of the launched activity.
Constant Value: 1 (0x00000001)
SPLASH_SCREEN_STYLE_SOLID_COLOR
public static final int SPLASH_SCREEN_STYLE_SOLID_COLOR
Flag to be used with [ActivityOptions.setSplashScreenStyle](/reference/android/app/ActivityOptions#setSplashScreenStyle%28int%29), to avoid showing the splash screen icon of the launched activity
Constant Value: 0 (0x00000000)
Public methods
clearOnExitAnimationListener
public abstract void clearOnExitAnimationListener ()
Clear exist listener
setOnExitAnimationListener
public abstract void setOnExitAnimationListener (SplashScreen.OnExitAnimationListener listener)
Specifies whether an [Activity](/reference/android/app/Activity) wants to handle the splash screen animation on its own. Normally the splash screen will show on screen before the content of the activity has been drawn, and disappear when the activity is showing on the screen. With this listener set, the activity will receive [OnExitAnimationListener.onSplashScreenExit](/reference/android/window/SplashScreen.OnExitAnimationListener#onSplashScreenExit%28android.window.SplashScreenView%29) callback if splash screen is showed, then the activity can create its own exit animation based on the SplashScreenView.
Note that this method must be called before splash screen leave, so it only takes effect during or before [Activity.onResume](/reference/android/app/Activity#onResume%28%29).
| Parameters | |
|---|---|
| listener | SplashScreen.OnExitAnimationListener: the listener for receive the splash screen with. This value cannot be null. |
setSplashScreenTheme
public abstract void setSplashScreenTheme (int themeId)
Overrides the theme used for the [SplashScreen](/reference/android/window/SplashScreen)s of this application.
By default, the [SplashScreen](/reference/android/window/SplashScreen) uses the theme set in the manifest. This method overrides and persists the theme used for the [SplashScreen](/reference/android/window/SplashScreen) of this application.
To reset to the default theme, set this the themeId to [Resources.ID_NULL](/reference/android/content/res/Resources#ID%5FNULL).
Note: Internally, the theme name is resolved and persisted. This means that the theme name must be stable across versions, otherwise it won't be found after your application is updated.
| Parameters | |
|---|---|
| themeId | int: The ID of the splashscreen theme to be used in place of the one defined in the manifest. |