Search code examples
androidandroid-studiokotlinauto-generateandroid-jetpack-navigation

Triggering auto gen code Android Navigation


I am learning Kotlin, and trying to set up Navigation in my app.

I am unable to find/trigger the auto generated code in Android Studio. Based on the navigation tutorial, I need to reference it to trigger an action on demand. It's my understanding HomeFragmentDirections is an auto-gen class.

view.findViewById<Button>(R.id.navigate_action_button)?.setOnClickListener {
    val flowStepNumberArg = 1
    val action = HomeFragmentDirections.nextAction(flowStepNumberArg)
    findNavController().navigate(action)
}

I have been following this.


Solution

  • Navigation directions get auto-generated only after a successful build. You should either go to Build -> Make Project

    or click on enter image description here.