Questions tagged [android-architecture-navigation]
The Navigation Architecture Component provides a framework for in-app navigation for Android apps.
1,339
questions
0
votes
1
answer
47
views
How to populate SavedStateHandle with navigation arguments in instrumentation test using Hilt and Jetpack Compose
I'm using a combination of Compose, Navigation, ViewModel and Hilt with SavedStateHandle to access nav arguments within the ViewModel. Everything works well together, however I've run into an issue ...
0
votes
1
answer
27
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 ...
0
votes
0
answers
10
views
How to open an intent category with a deeplink with navigation components
I am trying to open the app's additional settings screen from android.intent.category.NOTIFICATION_PREFERENCES.
I have a single activity pattern and the manifest looks like this:
<activity
...
0
votes
0
answers
8
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)....
0
votes
0
answers
140
views
Updating item in recyclerview, automatically updates viewmodel values even when it must not update - Navigation component
I am facing a weird problem in my application.
Basic structure of the app is that I have one MainActivity and that has many fragments. Using Navigation component (Sigh! why did I use that).
There's a ...
0
votes
0
answers
19
views
can we back with findNavController().navigateUp() with FragmentNavigator.Extras?
this is what AI (chat GPT-3) said to me
val extras = intent.extras
if (extras != null) {
val navController = findNavController(R.id.nav_host_fragment)
navController.navigateUp()
...
0
votes
0
answers
23
views
Navigation component: When using FragmentContainerView, TopLevel destination fragment not showing Hamburger (Drawer) icon
I have an app in which I am using Navigation component with nav_graph. The problem I am having is that Hamburger Icon (also known as Drawer Icon) isn't showing up.
I am following this documentation - ...
0
votes
0
answers
19
views
How to Not to Save State in Latest Navigation Component Android Library - Java
Component used: Navigation
Version used: 2.5.2
I would like to know if there's a way to stop saving states of different navigation views in the latest navigation library. As this is a default behavior ...
0
votes
1
answer
63
views
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()
...
0
votes
0
answers
12
views
How to make each fragment make it's own implementation for parent activity button listener
I'm using navigation component.
I don't want each fragment to have the next button.
My goal is putting that next button in activity, and each fragment implements its own destination and maybe doing ...
0
votes
0
answers
15
views
Using different nav graphs in android
I am using to manage screen with android navigation component and I have 2 different nav graphs. I have problem for move from one graph any screen to another graph any screen. These screens are not ...
0
votes
1
answer
27
views
Android navigation drawer layout menu item fragments not getting added to back stack
I've got a bug that I think may be unsolvable. I'm not sure what I am doing wrong; and I suspect that perhaps I am not doing things in the correct, 'android' way.
I have a single activity app with ...
0
votes
1
answer
23
views
I can't back press between fragments when clicking back press button
I am implementing an android application in kotlin and i can't navigate back between fragments and i get warning like :
Cancelling event due to no window focus: KeyEvent { action=ACTION_UP, keyCode=...
1
vote
0
answers
26
views
Navigation Component implicit deeplink with backstack
I have three screens. A, B and C.
A -> B -> C
What I want is that when I navigate to C with implicit deeplink (e.g. with a url), when back button is pressed, app goes to B, not A.
0
votes
0
answers
8
views
onBackPressed does work on fragments using navigation in kotlin
i am implementing an android applicationg opening the camera to record video . I am using navigation to go towards the camera fragment but i can go back to the previous fragment when BackPressing . I ...
1
vote
0
answers
119
views
How to navigate to a specific destination via deep link without adding any other destination in the backstack
Suppose I have the following setup:
nav_graph_a.xml
Fragment A (start destination)
includes nav_graph_b
nav_graph_b.xml
Fragment B (start destination)
Fragment C (has a deep link to it)
And an ...
0
votes
0
answers
279
views
Android - "Navigation destination that matches request NavDeepLinkRequest{ uri=android-app:/XXX } cannot be found" in fragment testing
I'm working on a multi-module single activity application. Each feature module has its own navigation graph. I'm trying to navigate to a feature module from the another one using deep link as ...
0
votes
0
answers
150
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, ...
1
vote
0
answers
24
views
Navigation Component with ContextMenu
I've a MainActivity linked with navigation component. Every fragment has its own implementation of Toolbar and I setup it, calling this method defined in the activity, from the specific fragment:
fun ...
0
votes
0
answers
45
views
Android - Navigation component with bottom tabs - Navigating from TabA to TabB programmatically
Context
The app operates on a single activity, with bottom tab navigation within it.
I have a button from "Home" tab, that when clicked, leads to TabB with arguments (to be used for ...
0
votes
0
answers
19
views
First Invoked method in fragment is onDestroy() not onAttach()
I am using Navigation component and Databinding and everything is fine but when it comes to fragment lifecycler it's getting a bit wiered. When i'm in a destination(fragment) and navigate to another ...
0
votes
0
answers
40
views
Remove weird flicker when using Paging and Navigation Component
Hello everybody,
Using the Android navigation component and Paging 3, I came across the following case:
The navigation component has a bottom navigation view and two fragments ListFragment (initial) ...
1
vote
1
answer
125
views
Android Navigation Component load 2 nested Fragments into Parent Fragment
I have a Comparator Screen which is a Fragment that is splitted into 2 sub-screens. Before using Navigation Component I could easily just:
private void initializeFragments() {
...
1
vote
2
answers
141
views
How is safe args in navigation component type safe (Android)?
In a normal fragment transaction we would pass data as:
Fragment fragment = new Fragment();
Bundle bundle = new Bundle();
bundle.putInt(key, value);
fragment.setArguments(bundle);
Isn't this type ...
0
votes
0
answers
32
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 ...
4
votes
1
answer
598
views
Android: How to prevent Scaffolds top app bar from redrawing in Jetpack Compose Navigation?
When navigating between two Screens, where each holds a Scaffold with a TopAppBar, the TopAppBar is animated to go out of the UI and back in. (short white flash in my example, just like the button ...
0
votes
0
answers
60
views
Android Navigation Component: Fragment with attached listener object
I have Fragment B
class FragmentB : Fragment() {
private var myListener: MyListener? = null
... //onCreate and other methods
...
fun setListener(listener: MyListener) {
...
0
votes
0
answers
37
views
Communication between fragments in landscape mode
I have two fragments in my app, FragmetHome and FragmentDetails. FragmentHome has a recycler view so when I click on an item FragmentDetails appears. This works fine for portrait mode. In landscape ...
1
vote
1
answer
2k
views
Bottom navigation bar appears above modal bottom sheet in jetpack compose
I have post in this post I have icon for comments when the user click on it, it should open modal bottom sheet but the problem is Bottom navigation bar appears above modal bottom sheet in jetpack ...
0
votes
0
answers
12
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 ...
0
votes
2
answers
121
views
Can i obseve fragment scrolling in activity?
I structured it like this:
FragmentContainerView in Main activity
ViewPager2 in HomeFragment
Nested scroll view / recycler view in ViewPager2 fragments
I want to set the visibility for a button in ...
0
votes
1
answer
1k
views
How to pop up to start destination (Compose Navigation)
I'm using the Navigation Component for Jetpack Compose.
I'm having troubles in clearing my backstack to contain only the starting destination when I navigate.
For example, if I have 3 screens A, B, C ...
0
votes
0
answers
257
views
How to solve "Navigation action/destination android:id/home cannot be found" error on Android?
I am implementing the Navigation Component in Android and I have a problem only in one point.
Everything works fine, but when I press the back button on the top bar, this error appears on the console (...
0
votes
0
answers
35
views
Navigation Fragment <include> Override the startDestination Value
i create multi-module Application and implement the navigation component. I have 2 navigation graph for :app and :features:transfer module.
Below is my :app's navigation graph:
<?xml version="...
1
vote
0
answers
110
views
Android Navigation - Navigate from dynamically added fragment
So I want to create a navigation flow as depicted in the image below:
The app is a single activity app. In the MainActivity, I have a FragmentContainerView, which is set to default nav host. Opening ...
0
votes
0
answers
53
views
Toolbar flicker/lag/jitter when using Navigation Component in Android
I am implementing toolbar using navigation component and there is a slight flicker/lag/jitter when navigating between fragments.
Issue 1:
When I navigate to another fragment it shows a back-arrow, I ...
0
votes
0
answers
47
views
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 ...
0
votes
1
answer
64
views
Using safeargs to create deep links
I am creating an explicit deeplink to a fragment in my app (Navigation component). This is how I am currently doing it:
val args = bundleOf(
"roomId" to roomId,
"receiver" ...
1
vote
0
answers
78
views
Simplest onBackPressed logic to be replaced using the OnBackPressedDispatcher interface
So, our project is compiling against & targeting Android SDK 33 which means the onBackPressed() function in Activity is deprecated and that needs to be converted to using the ...
0
votes
1
answer
81
views
Android Toolbar back button issue with AbstractListDetailFragment (or SlidingPaneLayout) navigation components
In an Android app, I'm using the Navigation components. In a couple of places, I have list/detail views. I'm using an AbstractListDetailFragment and have also tried SlidingPaneLayout. With ...
0
votes
0
answers
19
views
Navigate to fragment using navcontroller by sending fragment instance
I want to navigate to a fragment instance using navcontroller but it seems that I cannot add it unless I use the fragment Id or the direction with actions.
So I want to use something as:
val fragment2 ...
0
votes
1
answer
607
views
How can I send data in Jetpack compose between screens?
How can I send surveyToken here to ResultScreen?
surveyScreen(
moveToResult = { surveyToken ->
navController.navigateToResult(surveyToken)
}
)
And here's the navigateToResult ...
0
votes
0
answers
56
views
Child viewModel is recreated from scratch when using viewpager with navigation components
I display a ViewPager1 in the nav host using
class MyPagerAdapter(fragment: Fragment) : FragmentStatePagerAdapter(
fragment.childFragmentManager,
BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT
) {
...
0
votes
1
answer
84
views
Navigate to different fragments in another nav graph
I have to navigate from fragment in module 1 and navgraph #1 (let's call it first_nav_graph) to different fragments in another module and another navgraph #2 (let's call it second_nav_graph).
When I ...
0
votes
0
answers
41
views
How can i navigate through frtagments and have fragments state and all views state the way they were when i navigate back using Databinding?
I'm using databinding to make handling views and binding data to them easy for myself and i also use navigation component. Evething works fine but i can not save fragments'(destination) UI state. For ...
0
votes
0
answers
32
views
Update the title dynamically without navigating away, using navigation components
I am trying to dynamically update the title from a fragment. As the number of items in a list changes, the title would change accordingly.
I tried this
<fragment
android:id="@+id/...
0
votes
0
answers
176
views
How to navigate to deeply nested screen composable from the Activity's onCreate in Jetpack Compose
Suppose I have a notification, that when clicked, launches my app's activity. It's a notification about a message, in a conversation, and so it launches the activity passing the conversationId as an ...
0
votes
0
answers
35
views
What would be better approach to send data between fragments inside of ViewPager 2, and their host fragment?
I have an app with few fragments. There are one fragment, which is host for ViewPager 2, and there are 4 fragments, that are "swipeable". There's one more fragment, which is not present in ...
0
votes
0
answers
42
views
How do I remove update the start destination, removing the previous start destination from the backstack using Navigation Components
My flow is like:
if not logged in:
A) [Login fragment] (start dest.) -> [home fragment] (now this should become the start dest.)
(Now there should be no way to go ...
1
vote
0
answers
142
views
Android: Using deep link from API response while app is in foreground
I'm using an SDK and need to handle a deep link from an API call when the app has started. I'm using navigation component for my deep linking. I've found that when I get the deep link from the call ...