Skip to content

Snappy1

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

[FIXED] android – Is it possible to run code after pop back stack

Posted on November 11, 2022 By

Solution 1 :

Looks like popBackStack works asynchronously:

Pop all back stack states up to the one with the given identifier. This function is asynchronous — it enqueues the request to pop, but the action will not be performed until the application returns to its event loop.
(see here)

There’s an alternative popBackStackImmediate.

Problem :

requireActivity().onBackPressedDispatcher.addCallback(viewLifecycleOwner) {
    findNavController().popBackStack()
    //runs after popping off the back stack
    (activity as MainActivity).toolbar.visibility = View.VISIBLE
}

Is it possible to run code after popBackStack() given the fragment is already gone? If I put breakpoints, I found out that (activity as MainActivity).toolbar.visibility = View.VISIBLE runs before the fragment’s onPause() why it is the case?

READ  [FIXED] android - firebase cloud function error TypeError: Cannot read property 'child' of undefined
Powered by Inline Related Posts
Android Tags:android, kotlin

Post navigation

Previous Post: [FIXED] android – How to pass data by Back Button, Kotlin
Next Post: [FIXED] Project with external module issue in android studio 3.6

Related Posts

[FIXED] android – Handle button event of ListView of Fragment class? Android
[FIXED] inheritance – Companion object method not accessible from subclass Android
[FIXED] android – Where is the camera sensor booting setting? Android
[FIXED] android – Create a silent mp3 using TTS Android
[FIXED] How to prevent gradle.properties from being overwritten in Cordova Android? Android
[FIXED] java – How to see duration actively how much time pressing button on android 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 are the main features of Islamic education?
  • Is the Jeep 4xe worth it?
  • How does the ringer work on cast iron?
  • What is the biggest size interior door?
  • Is blue raspberry an original Jolly Rancher flavor?

Recent Comments

No comments to show.

Copyright © 2023 Snappy1.

Powered by PressBook Grid Dark theme