Splash Screen and Intents Completed the whole concept till v12 Showcasing some more functinality of intents
Intent Code
intent = Intent(this,Order::class.java).apply {
putExtra(KEY,orderPlaced)
}
startActivity(intent)
companion object{
const val KEY = "com.example.v13.MainActivity.KEY"
}
val orderOfCustomer = intent.getStringExtra(MainActivity.KEY)
And for Splash Screen
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.AppStarting" parent="Theme.SplashScreen">
<!-- for background color-->
<item name="windowSplashScreenBackground">@color/black</item>
<!-- for setting icon-->
<item name="windowSplashScreenAnimatedIcon">@drawable/group_2</item>
<!-- post splash screen theme or main Theme-->
<item name="postSplashScreenTheme">@style/Theme.ContactApp</item>
</style>
</resources>
<!--Set this theme to manifest file most important-->
<!-- add installsplashscreen() to every class not only on main class-->
add this to build.gradle file (app)
implementation 'androidx.core:core-splashscreen:1.0.0'
create a logo having 240X240 and item in 160X160 or 288x288 and icon 192x192(if dont have background) then see this documentation
-
creating splash.xml in value folder for both day and night having style parent
parent="Theme.SplashScreen"
and item given above -
change theme in android manifest from your theme to the theme you created in
splash.xml
-
add this
installSplashScreen()
on EACH AND EVERY Activity
View Binding
Code 1
val binding = ActivityOrderBinding.inflate(layoutInflater)
setContentView(binding.root)
Code 2
//inside of class
private lateinit var binding: ActivityMainBinding
//inside function
binding= ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)