public final class

NavOptions.Builder

extends java.lang.Object

 java.lang.Object

↳androidx.navigation.NavOptions.Builder

Overview

Builder for constructing new instances of NavOptions.

Summary

Constructors
publicBuilder()

Methods
public NavOptionsbuild()

public NavOptions.BuildersetEnterAnim(int enterAnim)

Sets a custom Animation or Animator resource for the enter animation.

public NavOptions.BuildersetExitAnim(int exitAnim)

Sets a custom Animation or Animator resource for the exit animation.

public NavOptions.BuildersetLaunchSingleTop(boolean singleTop)

Launch a navigation target as single-top if you are making a lateral navigation between instances of the same target (e.g.

public NavOptions.BuildersetPopEnterAnim(int popEnterAnim)

Sets a custom Animation or Animator resource for the enter animation when popping off the back stack.

public NavOptions.BuildersetPopExitAnim(int popExitAnim)

Sets a custom Animation or Animator resource for the exit animation when popping off the back stack.

public NavOptions.BuildersetPopUpTo(int destinationId, boolean inclusive)

Pop up to a given destination before navigating.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public Builder()

Methods

public NavOptions.Builder setLaunchSingleTop(boolean singleTop)

Launch a navigation target as single-top if you are making a lateral navigation between instances of the same target (e.g. detail pages about similar data items) that should not preserve history.

Parameters:

singleTop: true to launch as single-top

public NavOptions.Builder setPopUpTo(int destinationId, boolean inclusive)

Pop up to a given destination before navigating. This pops all non-matching destinations from the back stack until this destination is found.

Parameters:

destinationId: The destination to pop up to, clearing all intervening destinations.
inclusive: true to also pop the given destination from the back stack.

Returns:

this Builder

See also: NavOptions.getPopUpTo(), NavOptions.isPopUpToInclusive()

public NavOptions.Builder setEnterAnim(int enterAnim)

Sets a custom Animation or Animator resource for the enter animation.

Note: Animator resources are not supported for navigating to a new Activity

Parameters:

enterAnim: Custom animation to run

Returns:

this Builder

See also: NavOptions.getEnterAnim()

public NavOptions.Builder setExitAnim(int exitAnim)

Sets a custom Animation or Animator resource for the exit animation.

Note: Animator resources are not supported for navigating to a new Activity

Parameters:

exitAnim: Custom animation to run

Returns:

this Builder

See also: NavOptions.getExitAnim()

public NavOptions.Builder setPopEnterAnim(int popEnterAnim)

Sets a custom Animation or Animator resource for the enter animation when popping off the back stack.

Note: Animator resources are not supported for navigating to a new Activity

Parameters:

popEnterAnim: Custom animation to run

Returns:

this Builder

See also: NavOptions.getPopEnterAnim()

public NavOptions.Builder setPopExitAnim(int popExitAnim)

Sets a custom Animation or Animator resource for the exit animation when popping off the back stack.

Note: Animator resources are not supported for navigating to a new Activity

Parameters:

popExitAnim: Custom animation to run

Returns:

this Builder

See also: NavOptions.getPopExitAnim()

public NavOptions build()

Returns:

a constructed NavOptions