Skip to content

Snappy1

  • Home
  • Android
  • What
  • How
  • Is
  • Can
  • Does
  • Do
  • Why
  • Are
  • Who
  • Toggle search form

[FIXED] android – How to avoid adding a fragment to the backstack if it already exists using Navigation Architecture Component?

Posted on November 11, 2022 By

Solution 1 :

Yes you need to use setPopUpTo

Here is a good article to help you out

Problem :

I am using navigation component so I’m not using a FragmentManager. Let’s say I have fragments A, B.

If user navigates A -> B -> A -> B and then presses the back button I want the backstack to just be A instead of A -> B -> A. In other words don’t add a Fragment if it already exists in the backstack. Is this possible without using FragmentManager?

READ  [FIXED] java - SignUp rest service is not working when rest call is made from Android Application
Powered by Inline Related Posts
Android Tags:android, android-fragments, android-jetpack-navigation, android-navigation, android-navigation-graph

Post navigation

Previous Post: [FIXED] android – Convert BMP image to PNG or JPG in Java without loading the entire image in memory
Next Post: [FIXED] xml – Android – prevent TextView to push out another element inside LinearLayout

Related Posts

[FIXED] android – How can I resolve “An error occurred while running subprocess ng” when deploying ionic app? Android
[FIXED] java – How to get user both inserted sim card number? Android
[FIXED] How to click a button inside a recyclerview item in kotlin Android
[FIXED] c# – Changing language in Xamarin Forms Android
[FIXED] android – SQLDelight – Emit on Parent Tables when Child Tables are Modified Android
[FIXED] android – Download an image from Firebase Storage knowing the link Android

Archives

  • March 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022

Categories

  • ¿Cómo
  • ¿Cuál
  • ¿Cuándo
  • ¿Cuántas
  • ¿Cuánto
  • ¿Qué
  • Android
  • Are
  • At
  • C'est
  • Can
  • Comment
  • Did
  • Do
  • Does
  • Est-ce
  • Est-il
  • For
  • Has
  • Hat
  • How
  • In
  • Is
  • Ist
  • Kann
  • Où
  • Pourquoi
  • Quand
  • Quel
  • Quelle
  • Quelles
  • Quels
  • Qui
  • Should
  • Sind
  • Sollte
  • Uncategorized
  • Wann
  • Warum
  • Was
  • Welche
  • Welchen
  • Welcher
  • Welches
  • Were
  • What
  • What's
  • When
  • Where
  • Which
  • Who
  • Who's
  • Why
  • Wie
  • Will
  • Wird
  • Wo
  • Woher
  • you can create a selvedge edge: You can make the edges of garter stitch more smooth by slipping the first stitch of every row.2022-02-04
  • you really only need to know two patterns: garter stitch

Recent Posts

  • What is a good substitute for condensed milk?
  • ¿Como el cuerpo te avisa cuando te va a dar un infarto?
  • What is the luxury brand of Jaguar?
  • Who is Big poppa baseball player?
  • What material are foam runners?

Recent Comments

No comments to show.

Copyright © 2023 Snappy1.

Powered by PressBook Grid Dark theme