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
6
votes
1 answer

Unresolved Reference even after adding to gradle

I am getting resolved reference to these three classes: Timber Leak Canary findNavController I have added dependencies for these in my gradle i have these dependencies in other projects also but I am facing issue here. I have tried to: clean,…
6
votes
2 answers

The first item in the BottomNavigationView keep highlight when I select other item

The first item in the navigation bar keep highlighting. When I click other item on the navigation bar, the content will change but the corresponding item will not be highlighted, just keep highlighting the first item. …
felix12340
  • 77
  • 1
  • 5
6
votes
2 answers

Navigation drawer menu sub categories

I have a Navigation Drawer in my app using the DrawerLayout class and NavigationView. Right now I have my drawer showing all of my categories by inflating a menu xml file. How can I get it so that some of these categories are separated by…
Darren Mao
  • 63
  • 1
  • 4
6
votes
2 answers

Android: Why clicking on notification of intent with backstack destroys parent MainActivity?

Below is my sendNotification function which will be called from a Service, it's working fine creating a notification and showing it on the status bar. But when the app is already running (I'm at MainActivity),clicking on the notification to open…
6
votes
1 answer

How do I keep from focusing the last EditText when navigating from a tabbed Fragment?

I have 3 tabs in a ViewPager. Focus in Tab 2 is in the first EditText by default. When I navigate from Tab 2 to Tab 3 and back, I find that focus is in the last EditText of Tab 2. If I then go to Tab 1 and back, focus is back in the first EditText.…
6
votes
4 answers

Calculating Speed for a navigation app without getSpeed() method

I am developing an app which is more of a time-shift racing between your friends. I need to calculate speed of a moving vehicle, and I don't want to use Location.getSpeed() method. (Explained in detail in the bottom why I don't want to use it) I am…
Aman Alam
  • 11,231
  • 7
  • 46
  • 81
6
votes
1 answer

How do I set the parent activity of an activity at runtime?

I have an arbitrary number of hierarchically nested views/activities. The action bar should show the Up navigation button to navigate to a higher level in any view. For this, the google documentation says I have to set the parent activity with a …
6
votes
2 answers

How to hide ActionBar and NavigationBar after a certain delay time?

I would hide navigation bar and action bar of my app after some second that display don't get touched, and expand current view to fullscreen. Then if user touch the screen (or better if he swipe down), make visible both again. How to?
giozh
  • 9,868
  • 30
  • 102
  • 183
5
votes
1 answer

Jetpack Compose Navigation - Passing local file location as string

I am trying to pass audio file location(/storage/emulated/0/Android/media/...) as string from first screenhome_screen to second screendetail_screen, When I pass normally above string as a parameter I am getting this…
5
votes
0 answers

Jetpack Compose: Bottom bar and Nested Navigation

I have setup a Bottom Bar in project on Jetpack Compose app with 2 destinations. I have tried to follow the samples from Google. So for example it looks something like this: @Composable fun ExampleBottomBar(navController: NavHostController) { val…
5
votes
0 answers

how to redirect user to login page after sign out with jetpack compose navigation

I'm using jetpack compose in my project. My app contains multiple screens and nested navigation. So I have this in my MainActivity: val startDestination = if (setting.isUserLoggedIn) HomeNavGraph.HomeRoute.route else …
5
votes
1 answer

using setupWithNavController:2.5.0-alpha01 caused to OnViewCreated called every time

I use the navigation component and bottom navigation bar and for handling the tab bar navigation, call the below code binding.bottomNavigationView.setupWithNavController(navController) Before the last version, I had a big problem saving the states…
5
votes
1 answer

ClassNotFoundException in navigation graph android

I saw this crash over firebase and it is not reporducible in the emulator of same OS. Not sure what is causing it. Crash is occuring in samsung M32 OS 11. The crash is Caused by java.lang.RuntimeException: java.lang.ClassNotFoundException:…
5
votes
3 answers

Supporting both implicit and explicit deep linking with Navigation Component

I am using the Navigation Component and I am trying to trigger an explicit deep linking to a specific destination, represented by a Fragment, when the user taps on a notification. According to the documentation a pending intent can be create like…
5
votes
2 answers

Updated the Navigation framework and getting error - "getActionId overrides nothing"

I have updated the Navigation framework from 2.3.5 to the 2.4.0-alpha01 version. I use it with Safe Args gradle plugin. After update, I started getting 'getActionId' overrides nothing and 'getArguments' overrides nothing errors. I think this is…