Based on a default project template Fragment + ViewModel.
This app shows the usage of a splash screen and the navigation component, basically passing an object as parameter. This demonstration version uses buttons to send different information to the next fragment(dragon's detail fragment). We also use safeargs to pass the information via navigation controller.
The splash screen is used as a new theme, hence there is no activity for the splash screen which will otherwise make the user wait a defined period of time, before showing the main screen of your app.
create a theme in themes.xml, find it inside res/values/themes do it for both files, adding the following, and set your splash image.
<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowBackground">@drawable/httyd_splash_background</item>
</style>
next reference it in the AndroidManifest.xml file, change the theme of your entrypoint app class:
<activity android:name=".MainActivity" android:theme="@style/Theme.JetpackNavigation">
Lastly, do not forget to set the original theme(Base application theme, in this example AppTheme) of your MainActivity back, otherwise it will have the image as background. in the onCreate method of your MainActivity, before the super, add:
setTheme(R.style.Theme_JetpackNavigation);
That's all, it will show the splash screen image while your Activity is loading, so the user won't wait any additional time, more than the required to load the MainActivity.
Notice that there is no splash activity in the navigation graph.