gs1719 / Splash_And_Intents-v13

Splash Screen and Transfer Data through (companion object and intent)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

v13

Splash Screen and Intents Completed the whole concept till v12 Showcasing some more functinality of intents

CODES

Intent Code

within same app --> Explicit Intent

 intent = Intent(this,Order::class.java).apply {
                putExtra(KEY,orderPlaced)
            }
            startActivity(intent)

here KEY is companion object

 companion object{
        const val KEY = "com.example.v13.MainActivity.KEY"
    }

code for receiving Data on other class

 val orderOfCustomer = intent.getStringExtra(MainActivity.KEY)

And for Splash Screen

Example of splash.xml(night)

<?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-->

Video Link 1

Video Link 2

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

  1. creating splash.xml in value folder for both day and night having style parent parent="Theme.SplashScreen" and item given above

  2. change theme in android manifest from your theme to the theme you created in splash.xml

  3. add this

installSplashScreen()

on EACH AND EVERY Activity

View Binding

Official Documentation

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)

VIDEO

Project Demo Video

day13.webm

About

Splash Screen and Transfer Data through (companion object and intent)


Languages

Language:Kotlin 100.0%