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
0
votes
6 answers

Exit Android application on back button

I have ImageButton with back arrow in header of my application. When user presses it, I call finish() on current Activity. I also have option for user to go home, but I want to somehow clear Activity history, so when user presses back button on home…
Loadeed
  • 557
  • 2
  • 8
  • 18
-1
votes
2 answers

Passing data between fragments (tried all solutions

I've read (or tryied) all about here but I'm unable to pass a simple integer value between two fragments. My code is simple Fragment 1 Bundle n = new Bundle(); n.putInt("Id", 1); // test value NavController navController =…
-1
votes
1 answer

how to make visibility = View.GONE a certain view when launching a certain fragment when using navigation and BottomNavView

main_actiity.class activity_main XML photo main_fragment.class fragment_main XML photo enter image description here
-1
votes
1 answer

Android not getting proper navigation bar height for different device it not match with actual height which visible in nav bar

I am trying to get Bottom navigation bar height, because my view height is dynamic which is dependent on navigation bar height. But issue, In some device i get proper height of navigation bar, and in some device the height comes higher number then…
-1
votes
2 answers

How to fill in the TextViews with a field in a Data Class in Jetpack Compose?

So this project that I am involved in has me using Jetpack Compose to create my layouts for the first time. So I am pretty new to this. I have data classes that stored the data in them from an API. ViewModel/LiveData is also in use as well. My…
-1
votes
1 answer

Navigation component - back button exits the app

I have an issue with back button presses always exiting the app. This is a single activity app where the initial loaded screen is a two tab viewpager2 layout with 2 seperate nav graphs, one for each tab. The viewpager calls two "blank" fragments…
tommytucker7182
  • 213
  • 1
  • 5
  • 11
-1
votes
2 answers

Kotlin navigate with fragment name not id

If I use something like this navController.navigate(R.id.action_nav_home_to_profileFragment) it does navigate me to destination fragment (from my main fragment) because it has action in mainFragment navigation file, but if I'm in other fragments it…
mafortis
  • 6,750
  • 23
  • 130
  • 288
-1
votes
2 answers

Kotlin bundle returning null

I cannot get bundle (argument) value in my destination fragment, always return null. navigation file Commented.
mafortis
  • 6,750
  • 23
  • 130
  • 288
-1
votes
1 answer

Android Navigation - confirm user navigation

I use AndroidX Navigation component for fragment navigation inside my app. I have a scenario when I need to ask user whether he really wants to leave page or stay. I can do it easily for further navigation - just show AlertDialog and navigate on…
NapoleonTheCake
  • 311
  • 3
  • 9
-1
votes
1 answer

Unable to instantiate fragment com.nisarg.locsav.PhotoGallery: could not find Fragment constructor

I am facing a issue where i have created a fragment, nothing is wrong but still fragment does not open up. Here is my fragment: class PhotoGallery extends Fragment { RecyclerView recyclerView; PhotoGalleryAdapter photoGalleryAdapter; …
-1
votes
1 answer

How to add chevron in navigation drawer

I am using navigation drawer in my app, i have a requirement to add chevron at the end of each row like following Following is my code.
-1
votes
1 answer

StartDestination NullpointerException onSaveInstance when navigated away

I have a drawer layout which navigates between two fragments (just as it is set up when creating a new project with a drawer layout: so there is a navigation graph and general setup with AppBarConfiguration. I just removed a whole bunch of stuff so…
-1
votes
1 answer

Android Navigation overflow menu item overlapping fargments

I have been learning android navigation components from codelab, after following through steps, at step 8 I came across to a weird bug. Steps to reproduce: Enter application. From the overflow menu select Settings option. SettingsFragment is added…
-1
votes
1 answer

Access navigation controller from start destination fragment

I am using the new navigation from android jetpack. In my nav graph I got my LoginFragment as start destination and my MainActivity as host. When I run the app the LoginFragment gets displayed. My question: How can I navigate to other destinations…
-1
votes
1 answer

How to implement the method onNavigationItemSelected?

I have created a navigation drawer activity. I want to create a fragment that is opened when the respective item in the drawer list is clicked. How can I implement this so as to show an image when clicking on respective item?