Thread
#compose
    Nthily

    Nthily

    1 year ago
    I wrote a start screen, and then used the delay method to launch the main screen, but I found a problem, as long as I write navController.navigate after the delay method, I need to press the return button twice to end the program, but without the delay method only need to press once to end the program, I guess it may be a problem of the delay method, how should I fix it?
    val delayedHandler = Handler()
    delayedHandler.postDelayed({
        navController.navigate("mainPage") {
            popUpTo("welcome") { //delete
                inclusive = true //close stack
            }
        }
    }, 2000)
    but, if delayMillis is 20, its normal
    Samir Basnet

    Samir Basnet

    1 year ago
    Use LaunchedEffect to set delay . Don't make use of handlers or threads in Compose. There are various side effects that can fulfill your needs
    Nthily

    Nthily

    1 year ago
    omg thank you !