# NavigationEventInfo

Artifact: [androidx.navigationevent:navigationevent](https://developer.android.com/jetpack/androidx/releases/navigationevent) [View Source](https://cs.android.com/search?q=file:androidx/navigationevent/NavigationEventInfo.kt+class:androidx.navigationevent.NavigationEventInfo) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigationevent#1.0.0)

*** ** * ** ***


```
public abstract class NavigationEventInfo
```

<br />

Known direct subclasses [NavigationEventInfo.None](https://developer.android.com/reference/androidx/navigationevent/NavigationEventInfo.None)

|---|---|
| `https://developer.android.com/reference/androidx/navigationevent/NavigationEventInfo.None` | A default used when no specific information is associated with a navigation event. |

*** ** * ** ***

Provides contextual information about a navigation state (e.g., a screen or route).

Implement this interface on objects that represent a specific state in your UI. A typical implementation should be a data holder (such as a `data class`) that defines meaningful structural equality (`equals`/`hashCode`). This ensures that navigation state comparisons, state flows, and recompositions work as expected. Failing to provide proper equality can lead to unnecessary recompositions or infinite update loops.

Guidelines for implementors:

- Prefer `data class` to automatically provide equality and `toString`.

- Keep instances immutable for predictable behavior in state flows.

- Ensure equality reflects the logical identity of the navigation state.

This allows you to associate custom, comparable data with a system navigation event emissions.

## Summary

| ### Nested types |
|---|
| `public static class https://developer.android.com/reference/androidx/navigationevent/NavigationEventInfo.None extends https://developer.android.com/reference/androidx/navigationevent/NavigationEventInfo` A default used when no specific information is associated with a navigation event. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/navigationevent/NavigationEventInfo#NavigationEventInfo()()` |

| ### Public methods |
|---|---|
| `https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/navigationevent/NavigationEventInfo#getTitle()()` Defines the title of the navigation destination. |
| `https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/navigationevent/NavigationEventInfo#getUrl()()` Defines the URL or path representation of the navigation destination. |

## Public constructors

### NavigationEventInfo

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigationevent#1.0.0)

```
public NavigationEventInfo()
```

## Public methods

### getTitle

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/navigationevent#1.2.0)

```
public String getTitle()
```

Defines the title of the navigation destination.

Host environments can use this value to represent the active destination (e.g., a web browser's tab title).

Follow these best practices:

- **Localization**: Localize or translate the value.

- **Resolution**: Resolve resource IDs to strings before returning.

- **Formatting** : Interpolate dynamic parameters directly (e.g., `"Details - $id"`).

Defaults to `null`, meaning the title remains unchanged.

### getUrl

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/navigationevent#1.2.0)

```
public String getUrl()
```

Defines the URL or path representation of the navigation destination.

Host environments can use this value to update their location display (e.g., a web browser's address bar).

For web environments, this supports:

- **Full URL** (e.g., `"https://example.com/home"`): must match the active origin.

- **Relative path** (e.g., `"/home"`): appends to the active origin.

- **Hash fragment** (e.g., `"#home"`): triggers a hash navigation.

Defaults to `null`, meaning the location remains unchanged.