Search code examples
androidandroid-studiosplash-screenandroid-motionlayout

How can I move to the next screen after the splash screen is done in Android Studio?


I made a splash screen with motion layout. These are the codes.

the splash screen xml file

the .kt file that has the splash screen ( 1/2 )

the .kt file that has the splash screen ( 2/2 )

I am trying to move from MainActivity.kt(which is where the splash screen starts) to Intent_example2.kt.

I heard that that I have to deal with the Manifest.xml file, but I don't know the code for it.

Please help me , thank you.


Solution

  • onTransitionCompleted()

    Here, you're trying to move from MainActivity to MainActivity.

    Change

    startActivity(Intent(this@MainActivity, MainActivity::class.java)) 
    

    To

    startActivity(Intent(this@MainActivity, Intent_example2::class.java)) 
    

    And it should work fine.