Questions tagged [android-navigation]

For questions about navigation within and between Android apps. Examples include navigating between activities/fragments, up/back behavior, task stacks, and Intent flags that affect navigation behavior.

Consistent navigation is an essential component of the overall user experience. Few things frustrate users more than basic navigation that behaves in inconsistent and unexpected ways.

Android 3.0 introduced significant changes to the global navigation behavior. Thoughtfully following the guidelines for Back and Up will make your app's navigation predictable and reliable for your users.

Android 2.3 and earlier relied upon the system Back button for supporting navigation within an app. With the introduction of action bars in Android 3.0, a second navigation mechanism appeared: the Up button, consisting of the app icon and a left-point caret.

See also the official documentation about this topic.

1192 questions
14
votes
3 answers

Slide animation with navigation component

I'm using JetPack navigation component to navigate between fragments. I've added slide animation between 2 fragments in graph xml:
Rainmaker
  • 10,294
  • 9
  • 54
  • 89
14
votes
3 answers

how to pass a value back to previous fragment destination using Android navigation component?

let sat I have some destinations like this from fragment A --> to fragment B --> to fragment C I can use Safe Args to pass data from fragment A to fragment B. and also using safe args from fragment B to fragment C. what if I want to bring a string…
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
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…
14
votes
8 answers

Android navigate back to Application from Android Settings

I am having an inconsistent user experience due to the way android navigates back from Android Settings. In my application the user needs to give my app access to ACTION_USAGE_ACCESS_SETTINGS, which I access with the following: Intent intent = new…
Geordie Wicks
  • 1,065
  • 1
  • 11
  • 27
13
votes
0 answers

How does SavedStateHandle provide navigation arguments?

In Android Compose navigation, navigation arguments are populated in SavedStateHandle which can then be accessed in a ViewModel. I have done this in practice and implementation is well outlined here: https://stackoverflow.com/a/69145748/12385518. My…
Lucas
  • 323
  • 1
  • 8
13
votes
1 answer

passing ArrayList as argument in safeArgs

I'm trying to pass an ArrayList as an argument while using safeArgs. But when I select ArrayList from the list of serializable and build, it is throwing me these exceptions One type argument expected for class ArrayList One type…
13
votes
1 answer

NavigationComponent navigation within a BottomSheetDialogFragment

Can Android's Navigation Component be used for navigation WITHIN a BottomSheet (i.e. replacing/adding fragments within a single bottom sheet)? I know how to launch a BottomSheetDialogFragment using the tag within a Navigation Graph. For…
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
7 answers

Navigation error - This navigation graph is not referenced to any layout files?

I am trying to apply navigation feature to my project. And I have this error: This navigation graph is not referenced to any layout files(expected to find it in at least one layout file with a NavHostFragment with…
c-an
  • 3,543
  • 5
  • 35
  • 82
13
votes
3 answers

Android fragment navigation for tablets - single or multiple activities?

I'd like to achieve navigation like this (picture below), where fragments A,B,C,D represent navigation down the application's information hierarchy. On the phone only one fragment will be visible, and on the tablets there are two fragments visible.…
Axarydax
  • 16,353
  • 21
  • 92
  • 151
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
3 answers

Fragment has null arguments safeargs

How can I pass argument to dialog fragment using the navigation architecture component safeargs? below is my current implementation Start Fragment val navController = findNavController() val action = …
Ismail
  • 445
  • 1
  • 5
  • 20
12
votes
2 answers

How can you create a Deeplink using placeholders and nav component at build time

We have an app that utilises Deeplinks. We also use the Android Navigation component. Currently we configure our Deeplinks in out navigation.xml file and this works fine but we now have the requirement to be able to add another Deeplink at build…