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
17
votes
5 answers

Navigation Architecture Fragment Reload Problem

I am using Navigation Architecture in an image gallery, when I go from fragment A to B and then return back to A, these 3 methods are called again which will cause my gallery to reload, where I should load my data in fragment so when I come back…
17
votes
5 answers

How to implement shared transition element from RecyclerView item to Fragment with Android Navigation Component?

I have a pretty straightforward case. I want to implement shared element transition between an item in recyclerView and fragment. I'm using android navigation component in my app. There is an article about shared transition on developer.android and…
17
votes
6 answers

Androidx Navigation View - `setNavigationItemSelectedListener` Doesn't Work

What am I doing? I have been trying to work with Androidx Navigation Drawer(). I've read the documentation Here, which says that for handling item selections we can use…
17
votes
2 answers

Navigation Architecture component- How to refresh a fragment?

I have a ListFragment that has a recyclerview and onClick on any items opens the DetailsFragment. The details fragment contains another recyclerview on the bottom that shows "MORE ITEMS". Now onClick on any of these items should open the…
17
votes
7 answers

Android Navigation Architecture Component - Nav Drawer Icons

I'm currently using the Android Architecture Component's Navigation, but I'm running into an issue with my Navigation Drawer. It shows the hamburger menu when at my starting destination, but other Fragments are showing the up arrow. I believe I've…
17
votes
4 answers

Android Jetpack Navigation How to handle the Toolbar and BottomNavBar content

I am a bit confused on how the Navigation component fits in the app behavior. It all looks nice and shiny in tutorials where you don't do things too complex but when implementing in real app, things seem different. Before Navigation Before…
17
votes
4 answers

Fragment lifecycle overlap on navigate

I have a single Activity application with multiple Fragments that are being switched by using Navigation components. When I switch between two fragments their onCreate() and onDestroy() methods seem to overlap. Thus making it difficult for me to…
17
votes
8 answers

How to handle back button when at the starting destination of the navigation component

I've started working with the new navigation component and I'm really digging it! I do have one issue though - How am I supposed to handle the back button when I'm at the starting destination of the graph? This is the code I'm using…
16
votes
6 answers

JetpackCompose Navigation Nested Graphs cause "ViewModelStore should be set before setGraph call" exception

I am trying to apply Jetpack Compose navigation into my application. My Screens: Login/Register screens and Bottom navbar screens(call, chat, settings). I already found out that the best way to do this is using nested graphs. But I keep getting…
16
votes
1 answer

Hiding toolbar or bottomNavigationBar in Navigation Component

I followed guide from android.developers and implemented a navigation component into my app. I stumbled across a problem when I need some screens to be with or without a toolbar/bottom navbar. Android developers example's layout …
16
votes
5 answers

Android navigation components with deep link: onNewIntent called multiple times

This time I need your help regarding the use of android navigation components with deeplink. I have been following this documentation and the connection between fragment and deeplink is working fine. The problem comes in regards to the activity that…
16
votes
1 answer

Use same fragment multiple times in different navigation graph

In my project, I use the navigationextensions class "with 5 different navigation graph" from google example to handle the bottom navigation bar navigation in my project. goolge exmaple :…
16
votes
8 answers

Navigation Component in RecyclerView Adapter

I wrote the following piece of code in the adapter. holder.itemView.setOnClickListener { val action = SearchFragmentDirections.actionSearchFragmentToArtistFragment(artist.id) Navigation.createNavigateOnClickListener(action) } And this is…
16
votes
9 answers

Android Navigation Architecture Component: How to pass bundle data to startDestination

I have an activity which has a NavHostFragment. The activity receives certain values in its intent. I want to pass this data to the first fragment i.e startDestination of the navigation graph. I couldn't find any documentation regarding this. I have…
16
votes
7 answers

Show confirmation on back/up in Fragment with Navigation Architecture Component

I am using the Navigation Architecture Component for Android. For one of my fragments I wish to intercept "back" and "up" navigation, so that I can show a confirmation dialog before discarding any unsaved changes by the user. (Same behavior as the…
James
  • 3,597
  • 2
  • 39
  • 38