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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
5 views

Android differentiate between navigate with argument and navigateUp

I am using the Android Navigation component moving from fragment to fragment in my app So, I have a fragment defined something like this <fragment android:id="@+id/my_fragment_dest" ...
Kibi's user avatar
  • 1,910
1 vote
0 answers
41 views

Android navigation framework - effect of saveState

My app has 2 screens: ScreenA -> Has text that says "Screen A" and button. When button is pressed it leads to ScreenB ScreenB -> Has text that says "Screen B" At the bottom ...
rinaS's user avatar
  • 31
0 votes
0 answers
12 views

How to define individual toolbar for different destination's on Naviagtion drawer with Navigation component

I know this question has on answer on developer site **Support app bar varients **But they doesn't show the proper implementation of that using Navigation Component for app destination is simple and ...
Mubarak. M's user avatar
0 votes
1 answer
25 views

Using Fragment inside Navigation Fragment

Codes Main Activity // MainActivity.kt class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) ...
Eray Erdin's user avatar
  • 2,779
0 votes
1 answer
21 views

How to multiple call when navigate to other screen in Jetpack compose [duplicate]

In my application, I added animations anytime we navigate to another screen: NavHost( navController = navController, startDestination = startDestination, enterTransition = { ...
Stevie's user avatar
  • 423
0 votes
1 answer
71 views

Show/hide bottom tab bar while using Voyager in Compose multiplatform

I am using Voyager in my compose multiplatform project and I have a question regarding how we can show/hide the bottom tab bar based on the scrolling direction of a LazyColumn inside HomeTab. I have ...
Madhan Shah's user avatar
0 votes
0 answers
36 views

StateFlow doesn't trigger again

I have a problem that is apparently caused by a lack of understanding of StateFlow and its combination with Navigation. I am attaching the central main parts of the code related to my problem, it is ...
Mtuo's user avatar
  • 9
1 vote
0 answers
21 views

SafeArgs and View Binding properties visibility

This question could be applied to many other cases. In a android fragment class implemented with Kotlin, it's common to see this using View Binding and SafeArgs: class MyFragment: Fragment(){ var ...
mcventur's user avatar
0 votes
0 answers
31 views

How do I change android:defaultValue for an argument in the version 2.7.5 androidx.navigation.safeargs.kotlin?

In 2.7.3 and 2.7.4 it worked navController.setGraph(R.navigation.nav_graph, bundleOf("sslovo" to SkyConstants.skyStartSlovoSearch)) Now in version 2.7.5 I observe that the command .setGraph ...
ASDzendo's user avatar
0 votes
0 answers
45 views

After navigating to destination, start menu item is disabled

I have a single activity class with 2 fragments, both at the top level of my navigation hierarchy. Both fragments are connected to destinations, and they are shown in my navigation menu. Other than ...
perissf's user avatar
  • 16k
0 votes
0 answers
22 views

Navigate in android between compose navGraph and jetpack navigation

I have an android app written with kotlin + xml, recently we have migrated the home screen to be written with jetpack compose. now i do not know how to navigate from this home screen into any feature ...
hassanwasfy's user avatar
0 votes
0 answers
52 views

How to Pass a Function or Parameter Using findNavController().navigate() in Android Navigation

In my Android application, I have a Fragment called "Home" that displays a list of animals. This list is managed by an Adapter named "AnimalAdapter." Additionally, I have a Modal ...
Collaxd's user avatar
  • 471
0 votes
0 answers
38 views

Reselecting a tab on bottom navigation clearing stack while using navigation component

Have 4 fragments A,B,C,D in my bottom navigation setup with navigation component with A fragment as home destination , when I navigate from A to another fragment say fragment E with findNavController(...
Vicky Negi's user avatar
0 votes
0 answers
33 views

Use of ViewPager2 and Navigation causing multiple instantiation of home fragment

I am new to Android development and am completing a project in which I am required to use Jetpack Navigation. My app is a single-activity, multiple-fragment design. I am also trying to use ViewPager2 ...
Wade Byron Profe's user avatar
0 votes
1 answer
33 views

Why my imageUri change when I pass as a argument to another screen in jetpack compose?

I have a screen to select a photo from the gallery, and on this screen, I select the photo from the gallery and transfer the imageUri I selected to the screen I want to display. So, we can think of it ...
NewPartizal's user avatar
1 vote
1 answer
42 views

Can't see options menu bar

class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) } ...
Alperen Avan's user avatar
0 votes
1 answer
29 views

How to navigate from one fragment created in one Navigation graph to another fragment situated in another Navigation Graph?

I have created an MainActivity which has a fragment HelloFragment and a Navigation Graph nav_graph. And I also have another Activity WhyActivity which has a fragment WhyFragment and a Navigation Graph ...
vilnius19's user avatar
0 votes
0 answers
22 views

AlertDialog - How I can make OutlinedTextFields prepopulated when user opens the AlertDialog?

I'm working on a mobile app where users can create reports by entering basic information and specifying a location on Google Maps. Users open AlertDialog by clicking on the FAB. After users enter the ...
alsabih's user avatar
2 votes
1 answer
58 views

Android No destination with ID 2131362800 is on the NavController's back stack

I've encountered a severe crash on Firebase that happens on average 6 times per user. But do you have any ideas, help for this error that I can never repeat? It would be a good workaround though if I ...
umtblbl's user avatar
  • 123
1 vote
0 answers
540 views

enableEdgeToEdge - navigation system bar is not fully transparent

Why navigation system is not fully transparent? enableEdgeToEdge( statusBarStyle = SystemBarStyle.auto( Color.TRANSPARENT, Color.TRANSPARENT, ) { false }, ...
user924's user avatar
  • 8,857
0 votes
0 answers
17 views

How to check can navigate to a destination in Android Navigation Component?

I'm in fragment 'A'. How to check if I can navigate to another fragment like that findNavController().canNavigate(R.id.action_a_to_b)? Thank you!
soiXam's user avatar
  • 33
0 votes
1 answer
44 views

Need to use handler.postDelayed returning from a DialogFragment using navigation component return with a boolean argument

I am using Navigation component to launch & dismiss an ErrorDialog. I noticed that when I try to re-open the error dialog on a re-try flow I get an error that the action can't be found. It works ...
user1743524's user avatar
0 votes
0 answers
10 views

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)....
Thái Quốc Toàn's user avatar
0 votes
1 answer
51 views

How to prevent to reopen fragment in Main fragmet of BottomNavigation?

I have 5 item in BottomNavigationBar inside MainActivity class. When open EarningFragment it has FragmentContairView and it open MoneyDetailFragment from EarningFragment. When I opened this ...
Ahmet Yılmaz's user avatar
0 votes
0 answers
173 views

Handling Back stack Navigation in Compose

I have a question regarding compose navigation. I have Activity A which is child to other activity. Activity A has a composable view to set to the content. Now from A have to navigate to a fragment B ...
hamza khan's user avatar
0 votes
0 answers
12 views

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 ...
Patrick Renaud's user avatar
0 votes
0 answers
60 views

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 ...
Ashutosh Soni's user avatar
1 vote
1 answer
1k views

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 ...
Peter F's user avatar
  • 3,803
1 vote
0 answers
126 views

androidx.navigation:navigation-ui:2.6.0 and NavigationRuntimeIssueRegistry has been compiled by a more recent version of the Java Runtime

implementation "androidx.navigation:navigation-ui:2.5.3" was updated to implementation "androidx.navigation:navigation-ui:2.6.0". Now, Android Studio throws the following warning ...
Hong's user avatar
  • 17.9k
0 votes
4 answers
284 views

StateFlow/LiveData not updating after back pressed

I have a problem with the flow of data inside my application. I've got two Fragments, both of which modify the same data, and both of them go through a centralized Repository class in order to do so. ...
Ivan Garza's user avatar
0 votes
1 answer
56 views

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 = &...
Sammy Freeman's user avatar
0 votes
0 answers
15 views

Android Navigation: Conditional starting screen in subgraph

I have a navigation_graph_main.xml and want to navigate to a subgraph transaction_graph.xml. Inside the transaction graph, I have references to CreateIncomeTransactionFragment and ...
Eve's user avatar
  • 31
0 votes
0 answers
25 views

Navigation component - What is the mechanism behind for UI elements to retain their state?

When using Android Navigation Component, if we tap on the bottom view to switch away, and then switch back to the same fragment, we will have the following observation. A fragment will be destroyed, ...
Cheok Yan Cheng's user avatar
2 votes
2 answers
518 views

Navigation component - Why ViewModel is not re-created even though its owner (Fragment) is being re-created in NavHostFragment?

I am referring to the Bottom Navigation Views Activity template project created by Android Studio. I notice, whenever I tap on the bottom view to switch from DashboardFragment page, to another ...
Cheok Yan Cheng's user avatar
0 votes
1 answer
38 views

Android BottomNavigation startDestination looping onCreate Function

I have a very simple App with a MainActivity that holds a FragmentContainerView and a BottomNavigationView. In the FragmentContainerView i want to display one of three Fragments. The Fragments only ...
snux_cs's user avatar
  • 63
0 votes
0 answers
89 views

Clean Navigation in Compose using Compose Destinations Library

I am working in a Compose only project, I am wondering if there is a good solution for clean navigation (I feel like vm -> composable communication is ugly). I want viewModel to decide about ...
Teo Vladušić's user avatar
0 votes
0 answers
194 views

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, ...
Pratik Fagadiya's user avatar
0 votes
1 answer
68 views

Multiple versions of BottomNavigationView

I would like to have two versions of the BottomNavigationView, each with its own set of tabs. Some are shared, some not. For example, Version 1 has Fragment A, B, C, D on the bottom, version two has ...
Ana's user avatar
  • 89
0 votes
3 answers
53 views

Why Android saves state of EditText, but not TextView?

In Android project, I am trying to find out how the state saving works when I am navigating between fragments (by NavHostFragment). Let's say I have fragment A and fragment B: Fragment A includes one ...
Baterka's user avatar
  • 3,195
0 votes
1 answer
114 views

instrumentTesting with Espresso when facing with Splash Screen API and Navigation

How to perform Instrumental Testing or Android Testing when using Splash Screen API and Navigation. As we know, Activity is no longer needed to create splash screen, we just need to make new Theme to ...
dans's user avatar
  • 27
0 votes
0 answers
42 views

Switching between BottomNavigationView tabs, onDestroy of the fragment is called but still view restored on switching back. How?

I was exploring one of the navigation samples provided by Android here. Here each of bottom nav items has a nested graph of their own. Currently I'm on the Second tab (Leaderboard) and on changing ...
Saurabh Jaiswal's user avatar
1 vote
1 answer
29 views

Using Native Navigation + Compose TopAppBar is good idea?

I am using Fragment + Compose with Native Navigation (nav_graph.xml) in my project. Using TopAppBar like: @Composable fun SampleScreen( title: String, navController: NavController ) { ...
sss sss's user avatar
  • 184
1 vote
1 answer
241 views

Combine Bottom Navigation with NavHostController Jetpack Compose

I am trying to implement navigation in my Android app using JetpackCompose. What I am trying to do is I have a Bottom Bar with 4 buttons (Home, categories, cart, settings) Each of this screens have ...
Dave Kababyan's user avatar
1 vote
1 answer
280 views

Jetpack Compose with Navigation: why use it at all?

When programming for Jetpack Compose, I've been wondering why use Navigation at all. Wouldn't it be simpler to just hoist a state, say currentRoute and then use a when {} block to render the ...
rslemos's user avatar
  • 2,504
1 vote
0 answers
201 views

How to handle various App states effectively with conditional navigation in Jetpack Compose

Question: When navigating to another screen ( Home Screen ) from Login, the state of Login Composable persists and when coming back( Logging out ) from the HomeScreen, the logic brings to Home ...
mike20132013's user avatar
  • 5,357
-1 votes
2 answers
37 views

Passing data between fragments (tried all solutions

I've read (or tryied) all about here but I'm unable to pass a simple integer value between two fragments. My code is simple Fragment 1 Bundle n = new Bundle(); n.putInt("Id", 1); // test ...
Denis De Pauli 's user avatar
1 vote
1 answer
119 views

java - error: cannot find symbol . in generated classes SomeDirections.SomeAction

I am implementing navigation between Fragments from different flows (single-activity architecture with flow fragments) meaning from one nested graph to another. I am trying to pass one testID argument ...
Tatiana Kogai's user avatar
0 votes
1 answer
43 views

Transition in Android navigation between fragments

I know that there are two possibilities to add animation to any Android destination: Using graph, I can add manually animation file on enter/exit. Using Kotlin/Java with NavOptions and passing to ...
KurdTt-'s user avatar
  • 469
0 votes
0 answers
13 views

Cannot send arguments with Navigation Compose [duplicate]

So, I'm scratching my head to see why I cannot send arguments, this should be straight forward and I cannot do it, i'm getting an IllegalArgumentException: Navigation destination that matches request ...
SNM's user avatar
  • 5,915
0 votes
0 answers
21 views

How to make an animation to return from a fragment?

The scheme is this in the MainActivity FragmentContainerView, which starts the MainFragment, in which the BottomNavigationView, ViewPager2 and three fragments, I need to click on the button on one of ...
Binary's user avatar
  • 421

1
2 3 4 5
24