Handling URL Changes

The framework automatically reacts to the changes in the application URL: it tries to resolve the requested route and performs history navigation or opens a screen registered for this route.

When a screen is opened by a route with parameters, the framework sends a UrlParamsChangedEvent to the screen controller before the screen is shown. The same is happened when the URL parameters are changed while the screen is open. You can subscribe to this event to handle the initial parameters and their changes. For example, you can load data or hide/show screen UI components depending on the URL parameters.

An example of subscribing to the event in a screen controller:

protected void onUrlParamsChanged(UrlParamsChangedEvent event) {
    // handle

See a complete example of using UrlParamsChangedEvent below.