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.

Consistent navigation is an essential component of the overall user experience. Few things frustrate users more than basic navigation that behaves in inconsistent and unexpected ways.

Android 3.0 introduced significant changes to the global navigation behavior. Thoughtfully following the guidelines for Back and Up will make your app's navigation predictable and reliable for your users.

Android 2.3 and earlier relied upon the system Back button for supporting navigation within an app. With the introduction of action bars in Android 3.0, a second navigation mechanism appeared: the Up button, consisting of the app icon and a left-point caret.

See also the official documentation about this topic.

1192 questions
45
votes
5 answers

Pass data back to previous fragment using Android Navigation

I've started using Android Architecture Components (Navigation and Safe Args, View Models) along with Koin library. Currently, I've got a problem with passing arguments between two fragments - I need to pass a string value from fragment A to…
44
votes
2 answers

Scoping States in Jetpack Compose

In all applications there will always be this three scopes of state: With Compose, a "Per Screen State" could be achieved by: NavHost(navController, startDestination = startRoute) { ... composable(route) { ... val…
44
votes
6 answers

Make navigation drawer draw behind status bar

I'm trying to create a Nav Drawer like the one from the Material spec (like the one from the new gmail app). Note how the contents of the nav drawer draw behind the status bar: Using Chris Banes' answer from this question, I was able to…
Nathan Walters
  • 4,116
  • 4
  • 23
  • 37
43
votes
8 answers

How to detect bottom soft navigation bar available in android programmatically?

I am trying to determine soft navigation bar through the android program. I didn't find straight way to determine. Is there anyway to find the navigation bar availability. Soft Navigation bar image is here.
Raghu Mudem
  • 6,793
  • 13
  • 48
  • 69
42
votes
13 answers

Navigation Drawer item background colour for selected item

I used Android Studio to implement the Navigation Drawer and I can't get the blue colour that is used to show which section we're currently in to change. I've tried numerous things, I'm currently using a listSelector which looks like:
RyanJohnstone
  • 802
  • 1
  • 9
  • 21
41
votes
2 answers

How to resume activity instead of restart when going "up" from action bar

I have two activities. Say Activity A and Activity B. From Activity A I click a button to launch Activity B This is the code I use for this: Intent intent = new Intent(this, ActivityB.class); this.startActivity(intent); Now at this point, I am in…
Krimson
  • 7,386
  • 11
  • 60
  • 97
39
votes
11 answers

Android Navigation Component back button not working

I'm using the Navigation Component in android where I have set 6 fragments initially. The problem is when I added a new fragment (ProfileFragment). When I navigate to this new fragment from the start destination, pressing the native back button…
Christilyn Arjona
  • 2,173
  • 3
  • 13
  • 20
36
votes
5 answers

Android Jetpack Navigation with ViewPager and TabLayout

For a new app i use Jetpack Navigation Library to implement proper back navigation. The first level of navigation is a navigation drawer which works fine with jetpack navigation as described in the documentation. But there is another level of…
34
votes
10 answers

how to hide BottomNavigationView on android-navigation lib

I am trying to use android-navigation lib in my APP and I do the things as the tutorial said. I just wanna use one single activity in my APP. I am confused about one question. some fragments that just don't want the BottomNavigationView, how can I…
Freddy
  • 764
  • 2
  • 6
  • 21
33
votes
6 answers

BottomNavigation View OnNavigationItemSelectedListener is deprecated

I am trying out the Android's BottomNavigationView implementation as per Material Design However, on the MainActivity code I am getting a warning that OnNavigationItemSelectedListener is deprecated - see the below snapshot Have tried get an…
Tonnie
  • 4,865
  • 3
  • 34
  • 50
32
votes
2 answers

Navigation Drawer without Actionbar

I searched many sites (stackoverflow as well) but couldn't understand how to implement the navigation drawer without the action bar. I know that this question has already been asked here but it doesn't have a proper explanation and code. I am a…
Chinmay Dabke
  • 5,070
  • 11
  • 40
  • 63
31
votes
5 answers

Change Icon Of Navigation Drawer

I am having trouble with changing my navigation drawer icon to a custom one. I've currently had to implement the standard drawer icon which has 3 horizontal lines on top, but now I want to replace this with my custom drawer icon. This is how my…
31
votes
10 answers

Recycler View Not Showing

I have been making an app that uses a recycler view in a navigation drawer. Why the contents of the recycler view are not showing up. The view is definitely there as I can see the scroll shadows. I am not sure what I have done wrong, as the app does…
30
votes
6 answers

Remove up button from action bar when navigating using BottomNavigationView with Android Navigation UI library

I've created a small app that has three fragments for top-level navigation through a BottomNavigationView. If you launch the app and click on a navigation button on the bottom nav, you are presented with an up button in the action bar. Here is the…
27
votes
5 answers

Navigation graph with multiple top level destinations

I am implementing an android app (in Kotlin, but that is not relevant to the Problem) in my free time and I try to use android jetpack and new libraries. I have a single Activity with a navigation drawer. I try to follow the sample sunflower app. It…
findusl
  • 2,454
  • 8
  • 32
  • 51
1
2
3
79 80