@Test public void testSetGraph() { NavController navController = createNavController(); assertThat(navController.getGraph(), is(nullValue(NavGraph.class))); navController.setGraph(R.navigation.nav_start_destination); assertThat(navController.getGraph(), is(notNullValue(NavGraph.class))); assertThat(navController.getCurrentDestination().getId(), is(R.id.start_test)); }
public void setGraph(@NavigationRes int graphResId) { mGraph = getNavInflater().inflate(graphResId); mGraphId = graphResId; onGraphCreated(); }
NavController { public void setGraph(@NavigationRes int graphResId) { mGraph = getNavInflater().inflate(graphResId); mGraphId = graphResId; onGraphCreated(); } }
NavController { public void setGraph(@NavigationRes int graphResId) { mGraph = getNavInflater().inflate(graphResId); mGraphId = graphResId; onGraphCreated(); } NavController(@NonNull Context context); }
NavController { public void setGraph(@NavigationRes int graphResId) { mGraph = getNavInflater().inflate(graphResId); mGraphId = graphResId; onGraphCreated(); } NavController(@NonNull Context context); @NonNull NavigatorProvider getNavigatorProvider(); void addOnNavigatedListener(@NonNull OnNavigatedListener listener); void removeOnNavigatedListener(@NonNull OnNavigatedListener listener); boolean popBackStack(); boolean popBackStack(@IdRes int destinationId, boolean inclusive); boolean navigateUp(); void setMetadataGraph(); @NonNull NavInflater getNavInflater(); void setGraph(@NavigationRes int graphResId); void setGraph(@NonNull NavGraph graph); boolean onHandleDeepLink(@Nullable Intent intent); NavGraph getGraph(); NavDestination getCurrentDestination(); final void navigate(@IdRes int resId); final void navigate(@IdRes int resId, @Nullable Bundle args); @SuppressWarnings("deprecation") void navigate(@IdRes int resId, @Nullable Bundle args, @Nullable NavOptions navOptions); void navigate(@NonNull NavDirections directions); void navigate(@NonNull NavDirections directions, @Nullable NavOptions navOptions); @NonNull NavDeepLinkBuilder createDeepLink(); @Nullable Bundle saveState(); void restoreState(@Nullable Bundle navState); }
NavController { public void setGraph(@NavigationRes int graphResId) { mGraph = getNavInflater().inflate(graphResId); mGraphId = graphResId; onGraphCreated(); } NavController(@NonNull Context context); @NonNull NavigatorProvider getNavigatorProvider(); void addOnNavigatedListener(@NonNull OnNavigatedListener listener); void removeOnNavigatedListener(@NonNull OnNavigatedListener listener); boolean popBackStack(); boolean popBackStack(@IdRes int destinationId, boolean inclusive); boolean navigateUp(); void setMetadataGraph(); @NonNull NavInflater getNavInflater(); void setGraph(@NavigationRes int graphResId); void setGraph(@NonNull NavGraph graph); boolean onHandleDeepLink(@Nullable Intent intent); NavGraph getGraph(); NavDestination getCurrentDestination(); final void navigate(@IdRes int resId); final void navigate(@IdRes int resId, @Nullable Bundle args); @SuppressWarnings("deprecation") void navigate(@IdRes int resId, @Nullable Bundle args, @Nullable NavOptions navOptions); void navigate(@NonNull NavDirections directions); void navigate(@NonNull NavDirections directions, @Nullable NavOptions navOptions); @NonNull NavDeepLinkBuilder createDeepLink(); @Nullable Bundle saveState(); void restoreState(@Nullable Bundle navState); static final String KEY_DEEP_LINK_INTENT; }