Questions tagged [navcontroller]

14 questions
1
vote
1 answer

I want to find a better way to use NavHostController in compose

@Composable fun AppPage() { val navController = rememberNavController() //first way Page1(navController) //second way Page3 { navController.navigate("AnyRoute") } } @Composable fun Page1(navController:…
1
vote
0 answers

Using MDC SearchBar with NavController

I'm trying to setup searchBar with NavController, to use the back button as navigate up while in a fragment not registered in the AppBarConfiguration. I'm currently using MDC 1.9.0-rc01. The documentation of search bar it's not complete about this…
1
vote
1 answer

Android navigation graph with navviewholder fragment navigation issue when navigating using list click item

I have a very simple use case that I am surprised isn't working. I have a bottom view navigation controller with 2 fragments, a list fragment and a detailed fragment. When I navigate to the detail fragment page I have no problems navigating…
1
vote
1 answer

How to "Split your [settings] hierarchy into multiple screens" using NavController in Android?

So I'm creating my first Android App and I'm already using Jetpack Navigation. I also am implementing my own custom layouts with their own custom toolbars. However, I wanted to take advantage of the built in Jetpack Settings screen i.e. the AndroidX…
0
votes
0 answers

Android Jetpack Compose Navigation Screen Flickers

I am using Navigation in Compose. When user moves from one screen to another the screen flickers. The flickering appears to be due to the screen being rendered multiple times. I am not able to understand what is triggering multiple…
0
votes
1 answer

How to use NavHostFragment with ViewPager

So I've already read most of https://developer.android.com/guide/navigation/navigation-multi-module#groovy and fairly understand how to implement nav_graph and stuff. But I kinda have a bit of a complex use-case that I don't have a concrete idea on…
rminaj
  • 560
  • 6
  • 28
0
votes
1 answer

childFragmentManager.findFragmentById(R.id.nav_host_fragment_challenges) returns null

Thanks to a bottomNavigationView, I use NavController to navigate between 4 different fragments. In one of these fragments (ChallengesFragment) I have an inner_fragment (nav_host_fragment_challenges) but when I try to navigate in this inner_fragment…
0
votes
0 answers

Fragment title remain on previous fragments title when I press back button

By following this and this MO posts I tried to set title of app bar of my android project as follow: MainActivity @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); …
0
votes
1 answer

Handling game state running inside a webview fragment

I'm using single activity architecture and have 3 fragments (Fragment A, Fragment B and Fragment C). Click on button in Fragment A takes to Fragment B and click on button in Fragment B takes to Fragment C (which is a webview, a game is running…
Chandu
  • 339
  • 1
  • 7
0
votes
0 answers

How to continue with last screen when i exit or app is crashed on Android with Compose

I'm trying to create something for the Android app using Compose and navigation, to make it possible to continue with the last screen I was showing to the user if an app crashed or been killed by the user. I was searching for a solution on Google,…
0
votes
0 answers

How do I use Jetpack Navigation for a one-screen application (or can I avoid using Navigation)?

I am trying to learn java coding and I am building a simple one screen app in Android Studio following a tutorial. The tutorial was written before Jetpack Navigation was introduced and I am running into a compiler error related to Navcontroller…
0
votes
0 answers

how to navigate between different nav graph

I have two types of navigations for my mobile app - mobile navigation and search navigation. I am trying to move from the home fragment in the mobile navigation to the search fragment in the search navigation, but I am encountering an error. "…
0
votes
0 answers

create NavGraph programmatically that only includes other navGraphs

I am trying to build a navGraph programmatically and link it to a bottomNavigationView. I have to do it programmatically because I received the order of items and if they are visible from server. If i create a navGraph using xml, it works, but when…
0
votes
1 answer

"IllegalArgumentException: ID does not reference a View inside this Activity exception" when calling findNavController(activity, id) in onViewCreated

I'm getting an IllegalArgumentException with the message "ID does not reference a View inside this Activity" when calling findNavController(requireActivity(), R.id.mainNavHostFragment) inside the onViewCreated() method of a Fragment. The Fragment is…
Andrew
  • 2,438
  • 1
  • 22
  • 35