I enter the initial fragment of the app and on this screen I have a PagerView, when I change the fragment and I come back using the BACK BUTTON for the initial fragment this image disappears. So I put inside the onBackPressed code that loads the image and it worked, but it can only load when it is the initial fragment, so I have to know which fragment the back brought, I need the id to buy or something to compare:
Example without checking the fragment in OnBackPressed: Fragment A went to Fragment B Fragment B returned to Fragment A DEU BOM !!
Now if I do this: Fragment A went to Fragment B Fragment B went to Fragment C when I try to go back to B, it will not work because it does not have the PagerView that the method calls.
So I would like a way to check which fragment BackPress will take to see if it is the same as mine (R.id.nav_prg)