Questions tagged [android-architecture-navigation]

The Navigation Architecture Component provides a framework for in-app navigation for Android apps.

The Navigation Architecture Component is released as a part of Android JetPack and AndroidX package. It simplifies the navigation implementation in Android Apps. Its goal is to provide consistent and predictable experience to the end users, with single Activity Architecture. It also has support for Fragments and Deep-links. It has Navigation graph at the core of the library. Navigation Graph describes how the activities and fragments are related to each other and how the transition will work.

1346 questions
11
votes
1 answer

How to hide actionbar in some fragments with Android Navigation Components?

I am using android navigation components to navigate fragments. I can easily set action bar by using this code in the Main Activity : NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment); …
11
votes
1 answer

Required argument "name" is missing and does not have an android:defaultValue

I'm having a problem with my code i'm trying to pass arguments between fragments but it gives an exception java.lang.IllegalArgumentException: Required argument "name" is missing and does not have an android:defaultValue when run it. Im still still…
11
votes
3 answers

Navigation component - No Directions class generated

I have a fragment A where an action is originated to fragment B which have to receive an argument. When I try to set the argument before navigate, 'FragmentADirections' class can't be resolve. The fact is, I have a fragment C going to D with an…
11
votes
2 answers

NavDeepLinkBuilder destination ignored when app not in foreground

I am using NavDeepLinkBuilder to generate a pending intent for a push notification to open the app at a particular destination. return NavDeepLinkBuilder(this) .setComponentName(MainActivity::class.java) …
11
votes
1 answer

Android navigation component - navigating between included graphs of modules

I have a single activity application with 3 modules - app, list & detail. My activity is in app module, it's hosting the only NavHostFragment. All modules have their own navigation graphs. detail's starting point requires a long parameter. app's…
11
votes
7 answers

Navigation Component: IllegalStateException Fragment not associated with a fragment manager

I'm using the Navigation Component version 2.1.0-rc01 and I navigate back and forth between 3 screens using Navigation.findNavController(it).navigate(R.id.action_participants) After going through the same screens a second time I can see the second…
11
votes
3 answers

How to remove back button from toolbar when using bottom menu bar with navigation architecture components

I have an application which has a bottom menu bar which users can use to switch between 4 home page tabs. It's working fine like below. The only problem I'm having is it showing back button when I switch between different fragment. Since all these…
11
votes
1 answer

FragmentNavigator add Fragment instead of replace for transparent background

When using the Navigation library from AndroidX, I'd like to display a Fragment with a semi-transparent background on top of the old destination. So basically, instead of the FragmentNavigator doing ft.replace(mContainerId, frag) inside its…
11
votes
7 answers

How to use navigation component with clicks coming from RecyclerView elements?

I have a feed fragment that its main element is a RecyclerView of posts. I am managing the recycler with Lisa Wray's Groupie library https://github.com/lisawray/groupie Now in my navigation graph I have an action connecting the feed fragment to the…
11
votes
5 answers

How to prevent previous fragment to show up after pressing back button using navigation controller?

I am trying to use the navigation controller right now. I want to move from LoginFragment to HomeFragment. In LoginFragment I use this code below to move to HomeFragment. Navigation.findNavController(view).navigate(homeDestination) However, when I…
11
votes
4 answers

button back in startDestination with navigation component

I need a second activity with a nav graph and have a return button in toolbar to the first activity that also contains a nav graph In my second activity I have onSupportNavigateUp and setupActionBarWithNavController when entering the fragments if…
11
votes
1 answer

Recreating backstack with Android Navigation Architecture Component

I am trying to implement navigation to specific Detail pages of my app using PendingIntent from a notification, however I am having problems recreating the backstack from the Detail page all the way back to the start destination. I made a sample app…
11
votes
4 answers

Navigation DESTINATION_NAME is unknown to this NavController, ReOpening fragment previously closed using navController.popBackStack()?

I am using Navigation Component in my app , recently it was working correctly but after updating project to AndroidX I am getting error navigation destination DESTINATION_NAME is unknown to this NavController only if that destination(Which I'm…
11
votes
2 answers

Navigation component pop behavior is not working as it should

Inside an app I'm building I have used the single activity architecture and decided to use Google's new Navigation component to navigate around the app. Though it's showing great promise, it has some drawbacks which my question is about one of…
11
votes
2 answers

Multiple containers for navigation component

Is it possible to share navigation graph between two (or more) containers? What I would like to achieve is to have two containers (NavHosts): one smaller that is above bottom navigation and below toolbar second is full screen. I would like to…