Questions tagged [android-navigation-graph]

303 questions
5
votes
0 answers

Kotlin FCM Push Notification with Navigation Graph and 1 Activity App

I've built a FCM service for my Kotlin app, which is one activity and multiple fragment type app. I'm using the navigation graph to get from one fragment to the next. I'm able to see the push notifications come in for data and notification. Each…
5
votes
0 answers

Android Navigation Component: Self cycle destination with pop back stack by specific index

I have a navigation graph like this It's a folder/file listing app, when click a folder it will navigate to the same fragment with new instance by the action defined by the graph. After I navigate to some folders and currently in Folder D, a…
5
votes
1 answer

Exception inflating navigation graph

I just updated Android Studio to v3.5 and my project stopped to run, giving me the following Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mcampana.turle/com.mcampana.turle.MainActivity}:…
Mattia Campana
  • 509
  • 2
  • 6
  • 15
4
votes
1 answer

Android Navigation - how to go two destinations deep?

I have an app that manages Boxes. This app has a single activity and uses fragments as destinations. It has (among others) the following destinations/fragments: Home (registered as topLevelDestination) BoxesManagement (registered as…
4
votes
2 answers

NavigationComponent with multiple flavors

I'm using NavigationComponent in my app and now I'm facing following problem: I have 2 different flavors (free and paid version) which are using the same navigation.xml located in the main package. When I want to run e.g. the paid variant it failed…
4
votes
1 answer

Navigation Component - Access BuildConfig in nav graph

I have base url defined in my gradle file like buildTypes { debug { applicationIdSuffix ".debug" minifyEnabled false debuggable true buildConfigField("String", "BASE_URL", "\"https://abc.tech/api/\"") } …
4
votes
1 answer

Setting a graph programatically using setGraph() results in app's inability to restore the stack after process death (Jetpack Navigation)

I am currently in a situation where it might be unfeasible to refactor the whole app in order to make a more cohesive whole but the current approach to using Jetpack Navigation is causing crashes. The app has multiple graphs, for the sake of…
4
votes
1 answer

How to get view model with hilt outside activity in jetpack compose

So I have a kotlin file named "ListScreen" (it's not a class! just a .kt file with composable functions) and I'm handling transactions with compose navigation graph system. Right now I'm trying to access my ViewModel which is indicated with…
4
votes
0 answers

Navigation Component - Synthetic Back Stack

Situation: My app is designed to operate in the following way- 1. On fresh install: OpeningFragment -> Fragment1 -> Fragment2 2. Restarting the app, after closing it in Fragment2: OpeningFragment -> Fragment2 In the second situation I want Fragment1…
4
votes
0 answers

Android NavController best practice for shared fragments between different navigation flows/graphs

I am using NavController components in a single activity app. Each screen is different fragment. Each main UI flow in the app is separated in different navigation graphs (I do not want to have one big single xml with all the navigations). However…
4
votes
0 answers

How do I detect transition end in navigation graph?

I have following transition in my app, but the animation to the new destination lags because of extensive loading into recyclerview and other graphic elements. I have tried to use postDelayed when loading elements on the recyclerview, but on some…
Roar Grønmo
  • 2,926
  • 2
  • 24
  • 37
4
votes
3 answers

ANDROID Navigation Component + BottomNavigationView with backstack

I want use navigation component from jetpack in my app. I could find base examples work of nav component + bottom view navigation,below I showed how I implemented using these examples. But its works uncorrect for me - its recreate fragments when…
4
votes
1 answer

How to avoid adding a fragment to the backstack if it already exists using Navigation Architecture Component?

I am using navigation component so I'm not using a FragmentManager. Let's say I have fragments A, B. If user navigates A -> B -> A -> B and then presses the back button I want the backstack to just be A instead of A -> B -> A. In other words don't…
4
votes
1 answer

Pass argment to a nested graph's startDestination

I've created multiple graphs in separate files. The first one is GraphA and it's includes GraphB. the startDestination of GraphB is FragmentB that has an argument named AnID Now I want to pass the AnID from GraphA to GraphB (FragmentB) Despite of…
beigirad
  • 4,986
  • 2
  • 29
  • 52
4
votes
1 answer

How to add NavHostFragment in a Fragment destination?

My goal is to understand and use the Navigation component in the best way with a complex navigation architecture (I suppose). To make the global context, I use a main BottomNavigationBar with 5 items. For the management of the fragments associate, I…
1 2
3
20 21