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
14
votes
4 answers

ViewModel refetches data when fragment is recreated

I am using Bottom Navigation with Navigation Architecture Component. When the user navigates from one item to another(via Bottom navigation) and back again view model call repository function to fetch data again. So if the user goes back and forth…
14
votes
0 answers

Using Navigation Component, what is the proper way to navigate up when using NavHostFragments nested within other NavHostFragments

Please note that I am not talking about Nested Navigation Graphs here. I'm specifically talking about using NavHostFragments as subsections of other NavHostFragments and using the NavigationComponent to transition back and forth between the sub and…
JHowzer
  • 3,684
  • 4
  • 30
  • 36
14
votes
7 answers

How to navigate from nested Fragment to parent fragment using Jetpack Navigation?

I have main navigation: SplashFragment -> RegistrationFragment -> RootFragment
14
votes
1 answer

Android Navigation Architecture Component - Is Navigation Architecture Component meant to use Single Activity Only?

I currently learning on the new Android Navigation Architecture Component (https://developer.android.com/topic/libraries/architecture/navigation/). I kind of confuse with its motive and concept, here are my uncertainties: Is Android Navigation…
14
votes
3 answers

how to implement Conditional Navigation in navigation architecture components

In the new Navigation architecture component, how to implement conditional navigation? Currently I have a single activity with LoginFragment and HomeFragment. Based on a certain login_flag, I used to call either fragment from the MainActivity. Since…
14
votes
1 answer

Android Jetpack Navigation library and onActivityResult

I'm trying to migrate an app to the new Navigation Architecture Component that was announced at GoogleIO'18 Suppose I need to use an activity that is normally started with startActivityForResult. This activity comes either from a library or a system…
14
votes
2 answers

Jetpack Navigation: NavHostManager is not an active fragment of FragmentManager

I'm using Jetpack Navigation for handling the navigation for Fragments. I've been following the documentation and installed the required components, still the app just crash when trying to display the activity hosting the NavHost…
13
votes
5 answers

Android navArgs clear on back

Is there a way to clear navArgs after using them? I have fragment A that opens fragment B with navArgs, then I navigate to fragment C and the user presses back, so fragment B is opened with the same navArgs and I don't want that. Is there a way to…
13
votes
1 answer

Why Dialog does not have a NavController [Missing]?

I am trying to use the latest update of Nav Component in my application where i can add dialog(BottomSheetDialogFragment) in my nav graph nav_version = "2.1.0-alpha05" Part of code from my nav_graph:
13
votes
3 answers

Set toolbar title dynamically using navigation-component

I'm trying to set the toolbar title dynamically, I don't know if it's possible or not. Assume I have list of items every item I clicked it's open new fragment, thus I trying to change toolbar title for each item dynamically. I tried…
13
votes
2 answers

Back navigation after deeplink by navigation architecture component

When I open the app from a deeplink (user clicks on URL) and press back button I expect user to navigate to a previous fragment in my navigation graph but it just exits the app. The documentation says that back navigation should work the same way as…
13
votes
2 answers

Navigation Component , add or replace fragments or other things like hide show fragments

how can we specify replace or add fragment in Navigation component? NavHostFragment.findNavController(this).navigate(R.id.action_splashFragment_to_categoriesFragment)
Mohad Hadi
  • 1,826
  • 3
  • 24
  • 39
13
votes
2 answers

Jetpack navigation to a common destination

I've been using the new new Navigation-API in Jetpack and I've come across a problem that I can't find a satisfactory solution to. Basically the app I'm creating has a large number of different fragments. Most of the fragments talk to a backend and…
12
votes
1 answer

Android Navigation Component: How to solve the circular navigation with nested graph?

In our user requirement we have a flow like this. I have searched the following: https://developer.android.com/guide/navigation/navigation-principles Circular Reference with Nested Nav Graphs But nothing can help... What I have done? Currently I…
12
votes
2 answers

Reload fragment using Navigation Component

I am using the navigation component to load my fragments like given here: https://developer.android.com/guide/navigation/navigation-getting-started navController = findNavController(R.id.nav_host_fragment) // Passing each menu ID as a set of…