> For the complete documentation index, see [llms.txt](https://docs.mapbox.com/android/navigation/ux/llms.txt)

# Routes management

Every time UX Framework sets and updates routes and alternatives (or builds a new one in case a user goes off-route) an event is produced and dispatched. To get notified about the available routes changing, you can collect the `Dash.controller.observeRoutes` flow. The flow provides list of routes which includes primary (recommended as default) and alternative routes with a set of additional metadata.

```kotlin
class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
    
        lifecycleScope.launch {
            repeatOnLifecycle(Lifecycle.State.STARTED) {
                Dash.controller.observeRoutes()
                    .collect { /* RouteChangeEvent */ event ->
                        val activeNavRoute = event.routes.firstOrNull()
                        // Do something with active NavigationRoute
                    }
            }
        }
    }
}
```

Important to notice, that the route at index 0, if exists, is treated as the primary route for Active Guidance.