Questions tagged [android-jetpack-navigation]

Navigation between different screens and apps is a core part of the user experience. Android Jetpack Navigation Component helps the developer to implement it following the good practices. For more info see documentation: https://developer.android.com/guide/navigation

834 questions
16
votes
1 answer

How to force orientation for some screens in Jetpack Compose?

With jetpack compose navigation, I suppose it may become a single activity app. How to force orientation only for certain composables (screens)? Say if I want to force landscape only when playing video and not other screens? Without navigation, can…
rysv
  • 2,416
  • 7
  • 30
  • 48
16
votes
7 answers

TopAppBar flashing when navigating with Compose Navigation

I have 2 screens which both have their own Scaffold and TopAppBar. When I navigate between them using the Jetpack Navigation Compose library, the app bar flashes. Why does it happen and how can I get rid of this? Code: Navigation: @Composable fun…
16
votes
10 answers

Android Navigation component: No NavHostFragments found error

I am currently implementing the Navigation Component into my app but it seems finding the NavHostFragment just doesn't work no matter what I do. I have tried, rebuilding, invalidating, and restarting, changing the names around, and updating my…
efoc
  • 593
  • 2
  • 10
  • 26
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 :…
15
votes
1 answer

Jetpack Compose application-wide conditional TopAppBar best practice

I have an Android Jetpack Compose application that uses BottomNavigation and TopAppBar composables. From the tab opened via BottomNavigation users can navigate deeper into the navigation graph. The problem The TopAppBar composable must represent the…
15
votes
4 answers

Save and retain LazyColumn scroll position while using Paging 3

I am using the Paging 3 Library with Lazy Column and a BottomNavigation Menu in my Activity. Each Composable Screen attached to the BottomNavMenu uses a Composable that in turn uses Lazy Columns. When I navigate between the Composables using the…
15
votes
3 answers

Fragments are always recreated when used with Android navigation from jetpack

I am facing this issue of fragments recreation with Android navigation component. I have integrated bottom navigation and coupled it with the android navigation component. So, every time I click on a tab on bottom bar, the fragment is recreated and…
15
votes
2 answers

How to hide the bottom navigation bar in certain fragments?

I have An activity with a navGraph and a bottom Navigation bar with 2 menu items. My problem is that My Bottom Navigation Bar appears everywhere, detailFragment, aboutFragment, signInFragment and so on. val navController =…
14
votes
4 answers

Jetpack Navigation Animation Complete Listener

I'm trying to get a callback, using the Jetpack Navigation library, when a new navigation event is completed in order to change the status bar color. So far I've found navController.addOnDestinationChangedListener which notifies me when a new…
Alqueraf
  • 1,148
  • 1
  • 11
  • 26
13
votes
1 answer

onBackPressedDispatcher.onBackPressed() vs backPressedCallback.handleOnBackPressed()

Since the old Activity.onBackPressed() becomes deprecated starting Android 33, what is the better way to call it programmatically? Example: override fun onOptionsItemSelected(item: MenuItem): Boolean { when (item.itemId) { //…
13
votes
4 answers

Jetpack compose BottomNavigation - java.lang.IllegalStateException: Already attached to lifecycleOwner

When I double click the same item or if I go to each composable screen very quickly i receive an error, How do I solve this problem? I tried changing few things but I just can't solve it and I can't find any resources to fix this problem. Bottom…
13
votes
4 answers

Prevent navigating to the same fragment

I'm using Android navigation jetpack library with BottomNavigationView. I have implemented the NavHost, the NavGraph and my fragments. Everything is working as intented when I use actions to navigate. I use the following code to setup everything: …
12
votes
4 answers

Use Dialog as navigation destination with jetpack compose

A dialog can have a rather complex ui, acting more like a floating screen rather than a typical AlertDialog. Therefore it can be desired to let the dialog have its own ViewModel and being able to navigate to it. When using the jetpack compose…
Moritz
  • 10,124
  • 7
  • 51
  • 61
12
votes
1 answer

An implicit deep link from a notification in JetpackNavigation library

I'm trying to implement an implicit deep link handling in my application, but the following code doesn't work out and onNewIntent in my single activity isn't calling, but always startDestination from navigation graph is opening. In my navigation…
1 2
3
55 56