Questions tagged [android-navigation-graph]

303 questions
0
votes
0 answers

viewModelStore preserves wrong viewModel instance when setting navGraph dynamiclly

I have a fragment A that is used to host a nav graph but I would like to set the graph programmatically when having get the api result by this code findNavController().setGraph(R.navigation.nav_graph). Also in the fragment A I have create a…
0
votes
0 answers

Implicit DeepLink to a Dialog destination without opening a new activity

Is there any way to navigate to a destination through an implicit deep link without opening a new activity and without the nav_graphs knowing about each other? Suppose I have two Activities and two nav_graphs in my app. Activity A ->…
0
votes
0 answers

Move from an adapter to a fragment in kotlin

i am programming an android app in kotlin and i want to move from an adapter to a fragment after a click . But i can't use navigation there because of the action required ( i am used to use navigation between fragments not between an adapter and a…
0
votes
0 answers

How to reset the state of a nested navigation graph to the home fragment when selected?

I have an Android navigation setup with two navigation graphs. The first graph contains two items in the bottom navigation: "Item one" and "Item two." "Item one" points to "Navigation Graph1," while "Item two" points to a nested navigation graph,…
0
votes
1 answer

Compose navigation: Go to top-level destination when clicking on navigation bar item

I'm using Jetpack Compose and androidx-navigation-compose. Generally, I like the save/restore state mechanism when switching between bottom navigation tabs. However, if I'm in a detail screen of a particular tab and I click on the tab again I wnat…
0
votes
1 answer

App crash after upgrade navigation from 2.3.0 to 2.4.1

My app use dynamic-feature-module upgrade from //Navigation Component const val ANDROIDX_NAVIGATION_UI = "androidx.navigation:navigation-ui:2.3.0" const val ANDROIDX_NAVIGATION_UI_KTX = "androidx.navigation:navigation-ui-ktx:2.3.0" const val…
0
votes
1 answer

Hilt Navigation Compose makes TopAppBar starts flickering

In my project I'm using: implementation "androidx.hilt:hilt-navigation-compose:1.1.0-alpha01" Inside onCreate() I use: setContent { val navController = rememberNavController() NavGraph( navController = navController ) } And…
0
votes
0 answers

Prevent API call and data refresh when navigating back using Navigation Component in Android

I have an Android project where I'm using the Navigation Component to handle fragment navigation. In one of my fragments, I'm making an API call to fetch data and displaying it in the UI. However, whenever the user navigates back to this fragment…
0
votes
0 answers

how to clear all backstack after moving to new activity with Navigation Graph

I have several fragments, when the user has completed the onboarding stage he will be redirected to the MainActivity page. But when I want to enter the MainActivity page, the onboarding fragment appears for a few moments. How to fix it? The problem…
0
votes
0 answers

Should I use ViewModel, safe args or both? If both, how to do this a proper way?

There're 3 fragments AuthFragment - is responsible for the authentication of the user. The authenticated user is stored in the AuthUser class. The 'AuthUserclass is passed to theHomeFragment` via safe args. HomeFragment - is responsible for…
0
votes
0 answers

Admob banner not showing after the first time it's loaded

The admob banner loads the first time and is shown , but after I navigate to the other fragment and tap back it doesn't load again. ss class MainFragment : Fragment() { private lateinit var adView: AdView private var initialLayoutComplete =…
Rdog420
  • 1
  • 1
0
votes
2 answers

when I re-select menu items from bottom navigation view the fragments are recreating

I am using bottom navigation view with navigation components, when previous selected menu item is reselected fragment is reopening from oncreate When I open my activity document fragment is loading and when I select even fragment and again reselect…
0
votes
0 answers

NavGraph animations not working with bottom navigation view

I have a simple NavGraph and I'm trying to add some animations. The animations work when using findNavController().navigate(action) but not with the bottomnavigation view. I have tried with different variations of animations in the actions but…
0
votes
0 answers

Android nested graph for preferences fragment

I asked this question before here but made a mistake with one of the codeblocks I posted. Here it is again for your reference I have a standard bottom navigation selector using a navhost controller. I would like to add a PrefencesFragment that will…
0
votes
0 answers

Android Conditional Navigation

I've been practicing for a while with the Navigation component in Android and I would like to know what is the best way to perform a conditional initial navigation, depending on a specific state. For example, in a social network like Instagram, the…