# AppBarConfiguration.Builder

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

*** ** * ** ***

<br />

```
class AppBarConfiguration.Builder
```

<br />

*** ** * ** ***

The Builder class for constructing new `https://developer.android.com/reference/kotlin/androidx/navigation/ui/AppBarConfiguration` instances.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/navigation/ui/AppBarConfiguration.Builder#Builder(androidx.navigation.NavGraph)(navGraph: https://developer.android.com/reference/kotlin/androidx/navigation/NavGraph)` Create a new Builder whose only top level destination is the start destination of the given `https://developer.android.com/reference/kotlin/androidx/navigation/NavGraph`. |
| `https://developer.android.com/reference/kotlin/androidx/navigation/ui/AppBarConfiguration.Builder#Builder(kotlin.IntArray)(vararg topLevelDestinationIds: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Create a new Builder with a specific set of top level destinations. |
| `https://developer.android.com/reference/kotlin/androidx/navigation/ui/AppBarConfiguration.Builder#Builder(kotlin.collections.Set)(topLevelDestinationIds: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>)` Create a new Builder with a specific set of top level destinations. |
| `https://developer.android.com/reference/kotlin/androidx/navigation/ui/AppBarConfiguration.Builder#Builder(android.view.Menu)(topLevelMenu: https://developer.android.com/reference/android/view/Menu.html)` Create a new Builder using a `https://developer.android.com/reference/android/view/Menu.html` containing all top level destinations. |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/navigation/ui/AppBarConfiguration` | `https://developer.android.com/reference/kotlin/androidx/navigation/ui/AppBarConfiguration.Builder#build()()` Construct the `https://developer.android.com/reference/kotlin/androidx/navigation/ui/AppBarConfiguration` instance. |
| `https://developer.android.com/reference/kotlin/androidx/navigation/ui/AppBarConfiguration.Builder` | `[setDrawerLayout](https://developer.android.com/reference/kotlin/androidx/navigation/ui/AppBarConfiguration.Builder#setDrawerLayout(androidx.drawerlayout.widget.DrawerLayout))(drawerLayout: https://developer.android.com/reference/kotlin/androidx/drawerlayout/widget/DrawerLayout?)` **This function is deprecated.** Use {@link #setOpenableLayout(Openable)}. |
| `https://developer.android.com/reference/kotlin/androidx/navigation/ui/AppBarConfiguration.Builder` | `https://developer.android.com/reference/kotlin/androidx/navigation/ui/AppBarConfiguration.Builder#setFallbackOnNavigateUpListener(androidx.navigation.ui.AppBarConfiguration.OnNavigateUpListener)( fallbackOnNavigateUpListener: https://developer.android.com/reference/kotlin/androidx/navigation/ui/AppBarConfiguration.OnNavigateUpListener? )` Adds a `https://developer.android.com/reference/kotlin/androidx/navigation/ui/AppBarConfiguration.OnNavigateUpListener` that will be called as a fallback if the default behavior of `https://developer.android.com/reference/kotlin/androidx/navigation/NavController#navigateUp()` returns `false`. |
| `https://developer.android.com/reference/kotlin/androidx/navigation/ui/AppBarConfiguration.Builder` | `https://developer.android.com/reference/kotlin/androidx/navigation/ui/AppBarConfiguration.Builder#setOpenableLayout(androidx.customview.widget.Openable)(openableLayout: https://developer.android.com/reference/kotlin/androidx/customview/widget/Openable?)` Display the Navigation button as a drawer symbol when it is not being shown as an Up button. |

## Public constructors

### Builder

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

```
Builder(navGraph: NavGraph)
```

Create a new Builder whose only top level destination is the start destination of the given `https://developer.android.com/reference/kotlin/androidx/navigation/NavGraph`. The Up button will not be displayed when on the start destination of the graph.

| Parameters |
|---|---|
| `navGraph: https://developer.android.com/reference/kotlin/androidx/navigation/NavGraph` | The NavGraph whose start destination should be considered the only top level destination. The Up button will not be displayed when on the start destination of the graph. |

### Builder

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

```
Builder(vararg topLevelDestinationIds: Int)
```

Create a new Builder with a specific set of top level destinations. The Up button will not be displayed when on these destinations.

| Parameters |
|---|---|
| `vararg topLevelDestinationIds: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The set of destinations by id considered at the top level of your information hierarchy. The Up button will not be displayed when on these destinations. |

### Builder

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

```
Builder(topLevelDestinationIds: Set<Int>)
```

Create a new Builder with a specific set of top level destinations. The Up button will not be displayed when on these destinations.

| Parameters |
|---|---|
| `topLevelDestinationIds: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>` | The set of destinations by id considered at the top level of your information hierarchy. The Up button will not be displayed when on these destinations. |

### Builder

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

```
Builder(topLevelMenu: Menu)
```

Create a new Builder using a `https://developer.android.com/reference/android/view/Menu.html` containing all top level destinations. It is expected that the `https://developer.android.com/reference/android/view/MenuItem.html#getItemId()` of each item corresponds with a destination in your navigation graph. The Up button will not be displayed when on these destinations.

| Parameters |
|---|---|
| `topLevelMenu: https://developer.android.com/reference/android/view/Menu.html` | A Menu containing MenuItems corresponding with the destinations considered at the top level of your information hierarchy. The Up button will not be displayed when on these destinations. |

## Public functions

### build

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

```
fun build(): AppBarConfiguration
```

Construct the `https://developer.android.com/reference/kotlin/androidx/navigation/ui/AppBarConfiguration` instance.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/navigation/ui/AppBarConfiguration` | a valid `https://developer.android.com/reference/kotlin/androidx/navigation/ui/AppBarConfiguration` |

### setDrawerLayout

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/navigation#2.0.0) Deprecated in [2.3.0](https://developer.android.com/jetpack/androidx/releases/navigation#2.3.0)

```
fun [setDrawerLayout](https://developer.android.com/reference/kotlin/androidx/navigation/ui/AppBarConfiguration.Builder#setDrawerLayout(androidx.drawerlayout.widget.DrawerLayout))(drawerLayout: DrawerLayout?): AppBarConfiguration.Builder
```

> [!CAUTION]
> **This function is deprecated.**   
> Use {@link #setOpenableLayout(Openable)}.

Display the Navigation button as a drawer symbol when it is not being shown as an Up button.

| Parameters |
|---|---|
| `drawerLayout: https://developer.android.com/reference/kotlin/androidx/drawerlayout/widget/DrawerLayout?` | The DrawerLayout that should be toggled from the Navigation button |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/navigation/ui/AppBarConfiguration.Builder` | this `https://developer.android.com/reference/kotlin/androidx/navigation/ui/AppBarConfiguration.Builder` |

### setFallbackOnNavigateUpListener

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

```
fun setFallbackOnNavigateUpListener(
    fallbackOnNavigateUpListener: AppBarConfiguration.OnNavigateUpListener?
): AppBarConfiguration.Builder
```

Adds a `https://developer.android.com/reference/kotlin/androidx/navigation/ui/AppBarConfiguration.OnNavigateUpListener` that will be called as a fallback if the default behavior of `https://developer.android.com/reference/kotlin/androidx/navigation/NavController#navigateUp()` returns `false`.

| Parameters |
|---|---|
| `fallbackOnNavigateUpListener: https://developer.android.com/reference/kotlin/androidx/navigation/ui/AppBarConfiguration.OnNavigateUpListener?` | Listener that will be invoked if `https://developer.android.com/reference/kotlin/androidx/navigation/NavController#navigateUp()` returns `false`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/navigation/ui/AppBarConfiguration.Builder` | this `https://developer.android.com/reference/kotlin/androidx/navigation/ui/AppBarConfiguration.Builder` |

### setOpenableLayout

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

```
fun setOpenableLayout(openableLayout: Openable?): AppBarConfiguration.Builder
```

Display the Navigation button as a drawer symbol when it is not being shown as an Up button.

| Parameters |
|---|---|
| `openableLayout: https://developer.android.com/reference/kotlin/androidx/customview/widget/Openable?` | The Openable layout that should be toggled from the Navigation button |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/navigation/ui/AppBarConfiguration.Builder` | this `https://developer.android.com/reference/kotlin/androidx/navigation/ui/AppBarConfiguration.Builder` |