navigation/ui/src/main/java/androidx/navigation/ui/NavigationUI.java
public static boolean navigateUp(@Nullable DrawerLayout drawerLayout,
            @NonNull NavController navController) {
        if (drawerLayout != null && navController.getCurrentDestination()
                == findStartDestination(navController.getGraph())) {
            drawerLayout.openDrawer(GravityCompat.START);
            return true;
        } else {
            return navController.navigateUp();
        }
    }
/**
     * Handles the Up button by delegating its behavior to the given NavController. This should
     * generally be called from {@link AppCompatActivity#onSupportNavigateUp()}.
     * <p>If you do not have a {@link DrawerLayout}, you should call
     * {@link NavController#navigateUp()} directly.
     *
     * @param drawerLayout The DrawerLayout that should be opened if you are on the topmost level
     *                     of the app.
     * @param navController The NavController that hosts your content.
     * @return True if the {@link NavController} was able to navigate up.
     */
Handles the Up button by delegating its behavior to the given NavController. This should
generally be called from  AppCompatActivity#onSupportNavigateUp().
If you do not have a  DrawerLayout, you should call
NavController#navigateUp() directly.

@param drawerLayout The DrawerLayout that should be opened if you are on the topmost level
of the app.
@param navController The NavController that hosts your content.
@return True if the  NavController was able to navigate up.
Handles the Up button by delegating its behavior to the given NavController . This should generally be called from AppCompatActivity#onSupportNavigateUp () . If you do not have a DrawerLayout you should call NavController#navigateUp () directly . @param drawerLayout The DrawerLayout that should be opened if you are on the topmost level of the app . @param navController The NavController that hosts your content . @return True if the NavController was able to navigate up .
public static boolean navigateUp(@Nullable DrawerLayout drawerLayout,
            @NonNull NavController navController) {
        if (drawerLayout != null && navController.getCurrentDestination()
                == findStartDestination(navController.getGraph())) {
            drawerLayout.openDrawer(GravityCompat.START);
            return true;
        } else {
            return navController.navigateUp();
        }
    }
public static boolean navigateUp ( @ Nullable DrawerLayout drawerLayout , @ NonNull NavController navController ) { if ( drawerLayout != null && navController . getCurrentDestination ( ) == findStartDestination ( navController . getGraph ( ) ) ) { drawerLayout . openDrawer ( GravityCompat . START ) ; return true ; } else { return navController . navigateUp ( ) ; } }
Handles the Up button by delegating its behavior to the given NavController.
Handles the Up button by delegating its behavior to the given NavController .