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
20
votes
2 answers

Navigation Component Lifecycle

I have been trying out Navigation Component for a while now but somehow not getting the reason (or explanation) behind current Lifecycle of Navigation Component. Here are some points that needs clarification. 1. Fragment to Fragment flow In…
20
votes
2 answers

Avoiding Android navigation IllegalArgumentException in NavController

I recently switched over to Android Navigation, but have encountered a fair amount of situations (in different parts of the code), where I get: Fatal Exception: java.lang.IllegalArgumentException navigation destination…
Michael A.
  • 4,163
  • 3
  • 28
  • 47
20
votes
3 answers

Disable adding fragment to backstack in Navigation Architecture Component

Suppose i have 4 fragments: A, B, C, X, and I can navigate between them in this way: ... -> A -> C -> X and ... -> B -> C -> X But when I'm in fragment X call mNavController.navigateUp() I want skip fragment C and go to fragment A or B. What I…
20
votes
5 answers

Get Backstack status using android navigation component

I want to implement backpress behaviour such that it prompts a confirmation popup when you press back with the backstack empty, otherwise it pops the next fragment in the stack. I'm trying to get the backstack count, but i always get 0 from both…
20
votes
4 answers

How to set target fragment of a dialog when using navigation components

I'm showing a dialog inside a fragment using childFragmentManager or within an Activity using the supportFragmentManager, in the process I would like to set the target fragment, like this: val textSearchDialog =…
20
votes
3 answers

Android Navigation library deep linking: How to synthesise backstack

Using Android Architecture's Navigation component, I have the following navigation graph -> [Home] -> [Articles List] -> [Specific Article] I also have a deeplink to [Specific Article]. When it is opened, navigating up currently goes to [Home]. …
19
votes
3 answers

Proper usage of navigation component with view pager2 and nested navigation

I am trying to build the following view structure/ navigation using ViewPager2 + FragmentStateAdapter + navigation component. Preconditions: Single activity architecture, with one navigation graph 1. Fragment A holds a view pager. View pager uses…
Matin Petrulak
  • 1,087
  • 15
  • 23
19
votes
6 answers

How to remove only one fragment from backstack in fragment navigation component?

In my app i have used one activity and four fragment . In this app I used navigation component. My fragment loading sequence is A->B->C->D In fragment D On device back button press I want to remove fragment C from backstack so that fragment B can…
Sushant Bansode
  • 203
  • 1
  • 2
  • 5
19
votes
1 answer

androidx data binding life cycle NullPointerException

I cannot seem to find the origin of this DataBinding NullPointerException. While using Android Navigation Architecture when navigating to a Fragment and navigating up again repetitively I will eventually end up with the following stack…
19
votes
3 answers

Android Jetpack Navigation - Custom Action with Drawer Item

I am using the new Jetpack Android Navigation in combination with a Drawer Layout. Everything is working as expected when using the same IDs in the Drawer XML in combination with Fragments in the Navigation Graph. I set everything up with: override…
19
votes
4 answers

Single Activity with Navigation Component: how to handle different AppBar / Themes

I've been using the new Navigation Component since shortly after it has been announced at Google I/O, and also started to embrace the single-activity as much as possible. The Single Activity allowed me to share ViewModels between view for an awesome…
18
votes
6 answers
18
votes
1 answer

android - Navigation graph Flow Preview in landscape

The navigation graph preview of Android jetpack components always shows a portrait view of screens for the screens in the layout editor. Can we customize this to view the screens on an emulator of our choice?
18
votes
2 answers

Jetpack Navigation deeplink with query parameters

it looks like it isn't possible to process a deeplink with query parameters in the new Jetpack Navigation library. If you put the following to the navigation.xml: then the deeplink does…
bakua
  • 13,704
  • 7
  • 43
  • 62