Change theme
Help
Press space for more information.
Show links for this issue (Shortcut: i, l)
Copy issue ID
Previous Issue (Shortcut: k)
Next Issue (Shortcut: j)
Sign in to use full features.
Vote: I am impacted
Notification menu
Refresh (Shortcut: Shift+r)
Go home (Shortcut: u)
Use Markdown for this comment
Set severity, which reflects how much the issue affects the use of the product
Change issue status back to 'Assigned'
Pending code changes (auto-populated)
[ID: 84651]
Story points rate the relative effort of work in a Fibonacci-like format: 0, 0.5, 1, 2, 3, 5, 8, 13, 20, 40, 100. Each team will estimate work on a slightly different scale, which means the values in this field are likely only meaningful to the team that owns the Buganizer component in which the issue resides.
See Atlassian's Agile Coach for more information on how to use story points for estimation: https://www.atlassian.com/agile/project-management/estimation [ID: 746686]
Set the version(s) of the product affected by this issue (comma-separated list)
Set the version(s) of the product in which the issue should be fixed (comma-separated list)
Set the version(s) of the product in which the issue fix was verified (comma-separated list)
Set if this issue occurs in production
[ID: 85206]
Set Reporter
Set Type
Set priority, which reflects how soon the issue should be fixed
Set Status
Set Assignee
Set Verifier
Remove item
View or edit staffing
View issue level access limits(Press Alt + Right arrow for more information)
Description
#1Version used: 1.0.0-alpha1, using SDK 27/28
Devices/Android versions reproduced on: Emulators from API 21 to 26
When a Fragment is set as a "pop" destination for a action, it is "resumed" even though it is not shown on the screen.
I attached a sample projet to show the problem.
Here is the setup:
Very simple MainActivity, with one NavHostFragment and 3 Fragments: FragmentOne, FragmentTwo, FragmentThree.
The nav graph is simple:
* FragmentOne can go to FragmentTwo
* FragmentTwo can go to FragmentThree
* The "pop" destination of the action is FragmentOne
FragmentOne contains a Log.v() in its onResume() method.
How to reproduce:
* Start the app
* In Logcat, see "onResume", as the FragmentOne is shown
* Navigate to FragmentTwo
* Navigate to FragmentThree
* In Logcat, see "onResume", as the FragmentOne is resumed for some reason => BUG ?
* Press back
* In Logcat, see "onResume", as the FragmentOne is shown
As you see, the FragmentOne is shown only twice on screen, but Logcat shows "onResume" three times.
Now as a counter example:
* Open the Nav Graph and remove the "pop" destination (line 24, app:popUpTo="@+id/fragmentOne")
* Start the app
* In Logcat, see "onResume", as the FragmentOne is shown
* Navigate to FragmentTwo
* Navigate to FragmentThree
* In Logcat, you don't see anything
* Press back
* FragmentTwo is shown, nothing in Logcat
* Press back
* In Logcat, see "onResume", as the FragmentOne is shown
=> FragmentOne is shown twice, Logcat shows "onResume" twice.
To me it's clearly a bug as the whole lifecycle of FragmentOne is triggered even though the Fragment is never shown on screen.
It cause me a problem: I wanted to refresh my view (doing an HTTP fetch) when the Fragment is resumed. Because of this bug, the fragment fetches from the network even though it is never shown.
I tried to play with isVisible()
(
Any thoughts about this? Thanks!